Role introduced by plugin can not be assigned to node through fuel cli

Bug #1590191 reported by Michal Skalski
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Fuel for OpenStack
Fix Committed
High
Bulat Gaifullin
Mitaka
Fix Released
High
Bulat Gaifullin

Bug Description

*Detailed bug description:*

When I try assign custom role added by plugin using fuel cli I get error:

500 Server Error: Internal Server Error for url: http://10.20.0.2:8000/api/v1/clusters/1/assignment/ (Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nailgun/api/v1/handlers/base.py", line 170, in checked_data
    valid_data = method(data, **kwargs)
  File "/usr/lib/python2.7/site-packages/nailgun/api/v1/validators/assignment.py", line 100, in validate_collection_update
    dict_data[node_id]
  File "/usr/lib/python2.7/site-packages/nailgun/api/v1/validators/assignment.py", line 124, in validate_roles
    'version': settings.VERSION,
  File "/usr/lib/python2.7/site-packages/nailgun/api/v1/validators/assignment.py", line 151, in check_roles_requirement
    models, roles_metadata[role]['restrictions']
  File "/usr/lib/python2.7/site-packages/nailgun/utils/restrictions.py", line 200, in check_restrictions
    filterd_by_action_restrictions)
  File "/usr/lib/python2.7/site-packages/nailgun/utils/restrictions.py", line 199, in <lambda>
    strict=item.get('strict', strict)).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:detach-rabbitmq.metadata.enabled is undefined. Set options.strict to false to allow undefined values.
)

When I assign role through Web UI I don't see error.

*Steps to reproduce*

Install and enable plugin which introduce new role, for example https://github.com/openstack/fuel-plugin-detach-rabbitmq

Try to assign custom role to node:

fuel node set --node-id 1 --role standalone-rabbitmq --env 1

*Expected results*

Role assignment should be possible with fuel cli and web ui

*Actual result*

It is not possible to assign custom plugin role through fuel cli

*Environment*
Fuel 9.0
Snapshot: https://drive.google.com/file/d/0ByJ7mKmkSupcVHZlRTlramNUQjg/view?usp=sharing
BUILD_ID: 412

Tags: area-python
no longer affects: fuel/newton
Revision history for this message
Bulat Gaifullin (bulat.gaifullin) wrote :

need to fix restriction in role metadata of plugin, or add option strict=False

The error message contains right suggestion :)
    ' to false to allow undefined values.'.format(self.path))
TypeError: Value of settings:detach-rabbitmq.metadata.enabled is undefined. Set options.strict to false to allow undefined values.

Dmitry Pyzhov (dpyzhov)
Changed in fuel:
assignee: Fuel Sustaining (fuel-sustaining-team) → Matthew Mosesohn (raytrac3r)
tags: added: non-release
removed: area-python
Revision history for this message
Matthew Mosesohn (raytrac3r) wrote :

The plugin role requires that the plugin is enabled. This is normal. This is a nailgun bug

Changed in fuel:
assignee: Matthew Mosesohn (raytrac3r) → Bulat Gaifullin (bgaifullin)
Dmitry Pyzhov (dpyzhov)
tags: added: area-python
removed: non-release
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/327036

Changed in fuel:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to fuel-web (stable/mitaka)

Fix proposed to branch: stable/mitaka
Review: https://review.openstack.org/327118

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

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

commit d4f1785985f86715fc1e72d52c99680d906a7f94
Author: Bulat Gaifullin <email address hidden>
Date: Wed Jun 8 14:44:44 2016 +0300

    Allow to use plugin attributes in role restrictions

    Change-Id: Ie7960a765f5cf68437e0450c16d11f28fb105c13
    Closes-Bug: 1590191

Changed in fuel:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to fuel-web (stable/mitaka)

Reviewed: https://review.openstack.org/327118
Committed: https://git.openstack.org/cgit/openstack/fuel-web/commit/?id=b2ad4c9e6c8d8b7a3569c3b35d8d59294bce4f9a
Submitter: Jenkins
Branch: stable/mitaka

commit b2ad4c9e6c8d8b7a3569c3b35d8d59294bce4f9a
Author: Bulat Gaifullin <email address hidden>
Date: Wed Jun 8 14:44:44 2016 +0300

    Allow to use plugin attributes in role restrictions

    Change-Id: Ie7960a765f5cf68437e0450c16d11f28fb105c13
    Closes-Bug: 1590191

tags: added: on-verification
Revision history for this message
TatyanaGladysheva (tgladysheva) wrote :

Verified on:
[root@nailgun ~]# shotgun2 short-report
cat /etc/fuel_build_id:
 466
cat /etc/fuel_build_number:
 466
cat /etc/fuel_release:
 9.0
cat /etc/fuel_openstack_version:
 mitaka-9.0

Actual result:
Role assignment is possible with fuel cli and web ui.
For fuel cli:
[root@nailgun ~]# fuel node set --node-id 1 --role standalone-rabbitmq --env 1
Nodes [1] with roles ['standalone-rabbitmq'] were added to environment 1

[root@nailgun ~]# fuel nodes
id | status | name | cluster | ip | mac | roles | pending_roles | online | group_id
---+----------+------------------+---------+------------+-------------------+-------+---------------------+--------+---------
 1 | discover | Untitled (56:86) | 1 | 10.109.5.3 | 64:2b:64:ae:56:86 | | standalone-rabbitmq | 1 | 1
 2 | discover | Untitled (9e:32) | | 10.109.5.4 | 64:24:49:c9:9e:32 | | | 1 |
 5 | discover | Untitled (7b:4a) | | 10.109.5.7 | 64:cd:27:80:7b:4a | | | 1 |
 3 | discover | Untitled (93:c4) | | 10.109.5.5 | 64:d3:73:da:93:c4 | | | 1 |
 4 | discover | Untitled (24:1f) | | 10.109.5.6 | 64:e6:5d:e9:24:1f | | | 1 |

tags: removed: on-verification
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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