Merge "Don't JSON encode instance_info.traits for ironic" into stable/queens

This commit is contained in:
Zuul 2018-02-16 00:27:38 +00:00 committed by Gerrit Code Review
commit 62c5c727a9
2 changed files with 5 additions and 3 deletions

View File

@ -119,7 +119,7 @@ class IronicDriverFieldsTestCase(test.NoDBTestCase):
node = ironic_utils.get_test_node(driver='fake')
self.flavor['extra_specs']['trait:CUSTOM_FOO'] = 'required'
expected = [{'path': '/instance_info/traits',
'value': '["CUSTOM_FOO"]',
'value': ["CUSTOM_FOO"],
'op': 'add'}]
expected += self._expected_deploy_patch
patch = patcher.create(node).get_deploy_patch(
@ -130,7 +130,7 @@ class IronicDriverFieldsTestCase(test.NoDBTestCase):
node = ironic_utils.get_test_node(driver='fake')
self.flavor['extra_specs']['trait1:CUSTOM_FOO'] = 'required'
expected = [{'path': '/instance_info/traits',
'value': '["CUSTOM_FOO"]',
'value': ["CUSTOM_FOO"],
'op': 'add'}]
expected += self._expected_deploy_patch
patch = patcher.create(node).get_deploy_patch(

View File

@ -115,6 +115,8 @@ class GenericDriverFields(object):
patch.append({'path': '/instance_info/capabilities',
'op': 'add', 'value': jsonutils.dumps(capabilities)})
if traits:
# NOTE(mgoddard): Don't JSON encode the traits list - ironic
# expects instance_info.traits to be a list.
patch.append({'path': '/instance_info/traits',
'op': 'add', 'value': jsonutils.dumps(traits)})
'op': 'add', 'value': traits})
return patch