convert uids to list before passing to make_*_task

RoleResolver returns set of uids, but functions, which
make tasks want list.

Change-Id: I959a61a53ff55da400423ac871a2b61366c75f9a
Closes-Bug: #1606823
(cherry picked from commit 68c0d42ae0)
This commit is contained in:
Dmitry Guryanov 2016-09-13 18:24:27 +03:00 committed by Georgy Kibardin
parent 4dac11b4dd
commit 0b5b853317
2 changed files with 17 additions and 2 deletions

View File

@ -73,7 +73,7 @@ class BasePluginDeploymentHooksSerializer(object):
'not supported', task)
if make_task:
yield self._serialize_task(make_task(uids, task), task)
yield self._serialize_task(make_task(list(uids), task), task)
def _set_tasks_defaults(self, plugin, tasks):
for task in tasks:

View File

@ -15,6 +15,7 @@
# under the License.
import copy
import json
import mock
from nailgun import consts
@ -41,9 +42,23 @@ class TestBasePluginDeploymentHooksSerializer(base.BaseTestCase):
self.hook = BasePluginDeploymentHooksSerializer(
self.nodes,
self.cluster,
resolver=NullResolver([x['id'] for x in self.nodes])
resolver=NullResolver({x['id'] for x in self.nodes})
)
def test_tasks_are_serializable(self):
stage = 'pre_deployment'
role = 'controller'
plugin = mock.Mock()
plugin.full_name = 'plugin_name'
plugin.tasks = [
{'type': 'shell', 'role': role, 'id': '1', 'stage': stage,
'parameters': {'cmd': 'test1', 'cwd': '/', 'timeout': 15}},
]
raw_result = list(self.hook.deployment_tasks([plugin], stage))
json.dumps(raw_result)
def test_original_order_of_deployment_tasks(self):
stage = 'pre_deployment'
role = 'controller'