fuel-dev team mailing list archive
-
fuel-dev team
-
Mailing list archive
-
Message #00633
Re: Flexible yaml configuration mechanism in nailgun (roles disabling)
var = { 'attr1': True, 'attr2': False}
{ "key1": 1, "key2": '$var.attr1 and not $var.attr2' }
{ "key1": 1, "key2": True }
On Wed, Mar 12, 2014 at 3:38 PM, Evgeniy L <eli@xxxxxxxxxxxx> wrote:
> Hi Serg,
>
> Could you please provide an example? E.g. we have some dict
>
> { "key1": 1, "key2": ${ var.attr1 && not var.attr2 } }
>
> And I can render it to
>
> { "key1": 1, "key2": true } or { "key1": 1, "key2": false }
>
> How can I do it with YAQL?
>
>
>
> On Tue, Mar 11, 2014 at 5:08 PM, Serg Melikyan <smelikyan@xxxxxxxxxxxx>wrote:
>
>> >As for YAQL and JSONPath, I didn't see how it is possible to write
>> conditions like "a && !b || c". Their data aggregation capabilities are
>> decent, but at first we need to be able to write conditions.
>>
>> Full set of logic operations is supported: $.object.attribute1 and not
>> $object.attribute2 or $object.attribute3. Also there is true and false
>> constants available: $.object.attribute is true or even $.object.attribute
>> = true
>>
>>
>> On Tue, Mar 11, 2014 at 4:51 PM, Vitaly Kramskikh <
>> vkramskikh@xxxxxxxxxxxx> wrote:
>>
>>> Guys,
>>>
>>> As for using mako to preprocess YAML file, it could be a good idea to
>>> generate cluster settings on cluster creation (like removing vlan spliters
>>> section for a cluster with nova network) or volume groups, but I don't
>>> think it is a good idea to calculate role availability using it and it is
>>> impossible to set up dependencies between settings as it must be calculated
>>> in browser. For example, we could have vSphere hypervisor which is
>>> available only if vSphere section is enabled.
>>>
>>> As for YAQL and JSONPath, I didn't see how it is possible to write
>>> conditions like "a && !b || c". Their data aggregation capabilities are
>>> decent, but at first we need to be able to write conditions.
>>>
>>> But since we have toggleable sections, I doubt we even need these
>>> complex conditions as role/settings availability will only depend on
>>> section checkbox state. So flags/sections like "depends" and "conflicts"
>>> are more than enough for our needs.
>>>
>>>
>>> 2014-03-11 12:47 GMT+04:00 Serg Melikyan <smelikyan@xxxxxxxxxxxx>:
>>>
>>> There are a few examples on the project Github page<https://github.com/ativelkov/yaql>.
>>>> More details may be found in the article: Yet Another Query Language<https://docs.google.com/document/d/1Ct8aPUPPpSmUjh6ugtu_CEBRHfF3bBM5FxzgJ1f-Nwk/edit?usp=sharing>
>>>>
>>>>
>>>>
>>>> On Tue, Mar 11, 2014 at 12:42 PM, Serg Melikyan <smelikyan@xxxxxxxxxxxx
>>>> > wrote:
>>>>
>>>>> Hi, Evgeniy
>>>>>
>>>>> A few months ago we hit similar use-case in Murano: ability to express
>>>>> complicated conditions & queries. We used JSON Path, but it was not enough
>>>>> for us.
>>>>>
>>>>> One major thing that is required when you implementing such mechanism
>>>>> is restriction on Python usage - any executable code that can be executed
>>>>> on server is a security/stability issue. To solve this use-case without
>>>>> introducing ability to run any executable code we have created YAQL<https://github.com/ativelkov/yaql>
>>>>> .
>>>>>
>>>>> YAQL is very extensible and flexible library, that provides great
>>>>> conditions/query expirience out of the box. YAQL may be easily extended
>>>>> with own functions without adding anything in the library itself. Please,
>>>>> look at the YAQL and let's discuss how YAQL may help to solve your cases.
>>>>>
>>>>>
>>>>> On Fri, Mar 7, 2014 at 12:56 PM, Evgeniy L <eli@xxxxxxxxxxxx> wrote:
>>>>>
>>>>>> Hi Vitaly,
>>>>>>
>>>>>> I'm not sure that I understand you case correctly, but we can just a
>>>>>> render flag to enable or disable role.
>>>>>>
>>>>>> For example:
>>>>>>
>>>>>> roles_metadata:
>>>>>> controller:
>>>>>> name: "Custom Role Name"
>>>>>> description: "Role's description"
>>>>>> conflicts:
>>>>>> - compute
>>>>>> enable:
>>>>>> condition:
>>>>>> ${cluster.attributes.editable.additional_components.ceilometer.value}
>>>>>> description: "some error message"
>>>>>>
>>>>>> And for example we will be able to make more complicated conditions
>>>>>>
>>>>>> ${not
>>>>>> cluster.attributes.editable.additional_components.ceilometer.value}
>>>>>>
>>>>>> ${cluster.attributes.some_cluster_attr and not
>>>>>> cluster.attributes.some_cluster_attr2}
>>>>>>
>>>>>> But my suggestion is not to use such ugly construction in template
>>>>>> (it would be better to create a helper), but it will be really useful for
>>>>>> those who add new roles in fuel.
>>>>>>
>>>>>>
>>>>>> On Thu, Mar 6, 2014 at 10:04 PM, Vitaly Kramskikh <
>>>>>> vkramskikh@xxxxxxxxxxxx> wrote:
>>>>>>
>>>>>>> Hi Evgeniy,
>>>>>>>
>>>>>>> In that particular case with Ceph role availability dependent on
>>>>>>> settings, where would you use the template? Generate a role list using it?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> 2014-03-06 19:12 GMT+04:00 Evgeniy L <eli@xxxxxxxxxxxx>:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> We (python team) had a discussion about roles disabling feature [0]
>>>>>>>> with colleagues from UI team as result I've created a design document [1]
>>>>>>>> where I tried to describe problems which we have and possible solutions.
>>>>>>>>
>>>>>>>> Comments are welcome.
>>>>>>>>
>>>>>>>> [0]
>>>>>>>> https://docs.google.com/a/mirantis.com/document/d/1-YMcGX0JI4LwbrpsvA-ktIkxVqCI3bi7PQ6U0udW0O0/edit
>>>>>>>> [1]
>>>>>>>> https://docs.google.com/a/mirantis.com/document/d/1yBaIxUMnrFths7N1_qVkIivpR0GsYHRlGR3C8IZ9bbk/edit#
>>>>>>>>
>>>>>>>> --
>>>>>>>> Mailing list: https://launchpad.net/~fuel-dev
>>>>>>>> Post to : fuel-dev@xxxxxxxxxxxxxxxxxxx
>>>>>>>> Unsubscribe : https://launchpad.net/~fuel-dev
>>>>>>>> More help : https://help.launchpad.net/ListHelp
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Vitaly Kramskikh,
>>>>>>> Software Engineer,
>>>>>>> Mirantis, Inc.
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Mailing list: https://launchpad.net/~fuel-dev
>>>>>> Post to : fuel-dev@xxxxxxxxxxxxxxxxxxx
>>>>>> Unsubscribe : https://launchpad.net/~fuel-dev
>>>>>> More help : https://help.launchpad.net/ListHelp
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Serg Melikyan, Senior Software Engineer at Mirantis, Inc.
>>>>> http://mirantis.com | smelikyan@xxxxxxxxxxxx
>>>>>
>>>>> +7 (495) 640-4904, 0261
>>>>> +7 (903) 156-0836
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Serg Melikyan, Senior Software Engineer at Mirantis, Inc.
>>>> http://mirantis.com | smelikyan@xxxxxxxxxxxx
>>>>
>>>> +7 (495) 640-4904, 0261
>>>> +7 (903) 156-0836
>>>>
>>>
>>>
>>>
>>> --
>>> Vitaly Kramskikh,
>>> Software Engineer,
>>> Mirantis, Inc.
>>>
>>
>>
>>
>> --
>> Serg Melikyan, Senior Software Engineer at Mirantis, Inc.
>> http://mirantis.com | smelikyan@xxxxxxxxxxxx
>>
>> +7 (495) 640-4904, 0261
>> +7 (903) 156-0836
>>
>
>
--
Serg Melikyan, Senior Software Engineer at Mirantis, Inc.
http://mirantis.com | smelikyan@xxxxxxxxxxxx
+7 (495) 640-4904, 0261
+7 (903) 156-0836
References