Error while adding node to cluster with provided by plugin role via CLI

Bug #1585283 reported by Artem Roma
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Fuel for OpenStack
In Progress
Medium
Swann Croiset

Bug Description

The issue has been reproduced using fuel-plugin-kubernetes [0].

Steps to reproduce:
1) Build and install the plugin (build process, requirements, additional preparing steps for Nailgun has been described on the plugin page).
2) Try to assign nodes for cluster with provided by the plugin roles via CLI:
  fuel --env 1 node set --node-id 1 --role kubernetes-controller

Expected result:
  nodes are assigned

Actual result:
500 Server Error: Internal Server Error for url: http://10.20.0.2:8000/api/v1/clusters/3/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 102, in validate_collection_update
    dict_data[node_id]
  File "/usr/lib/python2.7/site-packages/nailgun/api/v1/validators/assignment.py", line 125, in validate_roles
    'cluster': cluster,
  File "/usr/lib/python2.7/site-packages/nailgun/api/v1/validators/assignment.py", line 157, in check_roles_requirement
    expression = condition['condition']
TypeError: string indices must be integers, not str
)

Version:
  Fuel 10.0, iso build #264

The error occurs in validation code here [1]. The reason is that first condition in restrictions, provided for the node role, is string and the access is done with assumption of dict. AFAIU, the first condition for all plugins will be a string because of the way restrictions object is built here [2]. So the solution will to fix code of the plugin adapter so the first restriction matches generally accepted dict format.

Please, note that the error only occurs while using CLI, in case a node is assigned to cluster via UI - everything works as expected as different API handler (and different validator) is invoked.

[0] https://github.com/mwhahaha/fuel-plugin-kubernetes
[1] https://github.com/openstack/fuel-web/blob/f38238175f7f9424fd642d8226d49befd62210b5/nailgun/nailgun/api/v1/validators/assignment.py#L151
[2] https://github.com/openstack/fuel-web/blob/1ce23a0f228ade53cf291ab9d597c28da027aabb/nailgun/nailgun/plugins/adapters.py#L171-L182

Changed in fuel:
assignee: Fuel Sustaining (fuel-sustaining-team) → Dmitry Guryanov (dguryanov)
Revision history for this message
Swann Croiset (swann-w) wrote :

I'm hitting this bug on MOS 9 (iso fuel-9.0-367)

I use Elasticsearch-Kibana plugin.
The initial deployment works fine with 1 controller + 1 elasticsearch-kibana node.

After adding a new Elasticsearch-kibana node through the Fuel UI (not the CLI) I get this error:

2016-05-30 09:27:59.632 ERROR [7f1e3bfc7880] (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 1450, in execute
    cls._check_nodes_roles(task)
  File "/usr/lib/python2.7/site-packages/nailgun/task/task.py", line 1531, in _check_nodes_roles
    roles, roles_metadata, models)
  File "/usr/lib/python2.7/site-packages/nailgun/api/v1/validators/assignment.py", line 153, in check_roles_requirement
    expression = condition['condition']
TypeError: string indices must be integers, not str

adding a print here[0] to debug the issue, the 'condition' variable is a string not a hash:

['settings:elasticsearch_kibana.metadata.enabled == false']

[0] https://github.com/openstack/fuel-web/blob/f38238175f7f9424fd642d8226d49befd62210b5/nailgun/nailgun/api/v1/validators/assignment.py#L151

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/322749

Changed in fuel:
assignee: Dmitry Guryanov (dguryanov) → Swann Croiset (swann-w)
status: Triaged → In Progress
Swann Croiset (swann-w)
Changed in fuel:
assignee: Swann Croiset (swann-w) → nobody
Changed in fuel:
assignee: nobody → Swann Croiset (swann-w)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on fuel-web (master)

Change abandoned by Swann Croiset (<email address hidden>) on branch: master
Review: https://review.openstack.org/322749
Reason: duplicate of https://review.openstack.org/#/c/322044/

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.