Deployment tasks has no ability for check whether some plugin installed.

Bug #1564131 reported by Vlad Naboichenko
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Fuel for OpenStack
Fix Released
Critical
Georgy Kibardin

Bug Description

I have 2 plugins, one custom, and one, for example, contrail plugin. I want have a possibility to deploy my custom plugin with enabled contrail plugin, or with disabled(undefined)

Here is the task with condition.

- id: some_task_if_contrail_disabled
  groups: [compute]
  type: puppet
  version: 2.0.0
  condition: "settings:contrail == null or settings:contrail.metadata.enabled == false"
  requires: [deploy_start, setup_repositories]
  required_for: [tools, fuel_pkgs]
  parameters:
    ....

Here is what i see in logs when i enable only my custom plugin without contrail

/var/log/nailgun/app.log

2016-03-30 16:45:25.330 INFO [7f573fdc2880] (task) start tasks serialization.
2016-03-30 16:45:26.249 ERROR [7f573fdc2880] (manager) Traceback (most recent call last):
 File "/usr/lib/python2.7/site-packages/nailgun/task/manager.py", line 57, in _call_silently
   to_return = method(task, *args, **kwargs)
 File "/usr/lib/python2.7/site-packages/nailgun/task/task.py", line 275, in message
   affected_nodes, task_ids, reexecutable_filter
 File "/usr/lib/python2.7/site-packages/nailgun/task/task.py", line 142, in call_deployment_method
   method, args = message_builder(transaction, *args, **kwargs)
 File "/usr/lib/python2.7/site-packages/nailgun/task/task.py", line 376, in task_deploy
   selected_task_ids, tasks_events
 File "/usr/lib/python2.7/site-packages/nailgun/orchestrator/task_based_deployment.py", line 441, in serialize
   serializer.resolve_nodes(add_plugin_deployment_hooks(tasks))
 File "/usr/lib/python2.7/site-packages/nailgun/orchestrator/task_based_deployment.py", line 467, in resolve_nodes
   self.process_task(task, self.role_resolver, skip)
 File "/usr/lib/python2.7/site-packages/nailgun/orchestrator/task_based_deployment.py", line 488, in process_task
   skipped = skip or not task_serializer.should_execute()
 File "/usr/lib/python2.7/site-packages/nailgun/orchestrator/tasks_serializer.py", line 67, in should_execute
   self.task['condition'], self._expression_context).evaluate()
 File "/usr/lib/python2.7/site-packages/nailgun/expression/__init__.py", line 27, in evaluate
   return self.compiled_expression()
 File "/usr/lib/python2.7/site-packages/nailgun/expression/objects.py", line 36, in __call__
   self.evaluate()
 File "/usr/lib/python2.7/site-packages/nailgun/expression/objects.py", line 32, in evaluate
   self.value = self.subexpression()
 File "/usr/lib/python2.7/site-packages/nailgun/expression/expression_parser.py", line 99, in <lambda>
   result = lambda: arg1() == arg2()
 File "/usr/lib/python2.7/site-packages/nailgun/expression/objects.py", line 83, in __call__
   self.evaluate()
 File "/usr/lib/python2.7/site-packages/nailgun/expression/objects.py", line 78, in evaluate
   ' to false to allow undefined values.'.format(self.path))
TypeError: Value of settings:contrail.metadata.enabled is undefined. Set options.strict to false to allow undefined values.

It would be great to be options.strict=False by default when conditions into the tasks processed.

summary: - Deployment fails with error Value of settings:contrail.metadata.enabled
- is undefined.
+ Deployment tasks has no ability for check whether some plugin installed.
Changed in fuel:
status: New → Confirmed
importance: Undecided → High
tags: added: module-nailgun
removed: area-library
tags: added: customer-found
description: updated
description: updated
Changed in fuel:
importance: High → Critical
assignee: nobody → Fuel Python Team (fuel-python)
Changed in fuel:
milestone: none → 9.0
tags: added: area-python
Revision history for this message
Bug Checker Bot (bug-checker) wrote : Autochecker

(This check performed automatically)
Please, make sure that bug description contains the following sections filled in with the appropriate data related to the bug you are describing:

actual result

expected result

steps to reproduce

For more detailed information on the contents of each of the listed sections see https://wiki.openstack.org/wiki/Fuel/How_to_contribute#Here_is_how_you_file_a_bug

tags: added: need-info
Revision history for this message
Bulat Gaifullin (bulat.gaifullin) wrote :

need to use YAQL expressions that is supported since 9.0

in YAQL this condition will be:
'
  condition:
      yaql_exp: "not bool($.get(contrail, {}).get(metadata, {}).get(enabled))"

Changed in fuel:
status: Confirmed → Invalid
Revision history for this message
Bulat Gaifullin (bulat.gaifullin) wrote :

need to disable strict attributes fetching in legacy expressions evaluator.

Changed in fuel:
status: Invalid → Confirmed
Revision history for this message
Sergey Vasilenko (xenolog) wrote :

we need such functionality for old 1.0 tasks

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to fuel-web (master)

Fix proposed to branch: master
Review: https://review.openstack.org/299955

Changed in fuel:
assignee: Fuel Python Team (fuel-python) → Georgy Kibardin (gkibardin)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to fuel-web (master)

Reviewed: https://review.openstack.org/299955
Committed: https://git.openstack.org/cgit/openstack/fuel-web/commit/?id=141e07e0e634ff35e5f8aeec548fa2f06d01ba65
Submitter: Jenkins
Branch: master

commit 141e07e0e634ff35e5f8aeec548fa2f06d01ba65
Author: Georgy Kibardin <email address hidden>
Date: Thu Mar 31 17:03:49 2016 +0300

    Disabling strict attributes fetching in legacy expressions

    Change-Id: I5e1dba004e5ed0faba99c272d0b403cba79c753f
    Closes-Bug: 1564131

Changed in fuel:
status: In Progress → Fix Committed
tags: added: dev-to-verify
Changed in fuel:
status: Fix Committed → Incomplete
status: Incomplete → Fix Committed
Revision history for this message
Bulat Gaifullin (bulat.gaifullin) wrote :

the legacy conditions is evaluated by option 'strict=False', this prevents raising of exception in case if expression contains undefined attribute. the bug is fixed.

https://github.com/openstack/fuel-web/blob/stable/mitaka/nailgun/nailgun/lcm/task_serializer.py#L99

Changed in fuel:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.