diff --git a/ironic/conductor/utils.py b/ironic/conductor/utils.py index 621e73d931..0a0799e89f 100644 --- a/ironic/conductor/utils.py +++ b/ironic/conductor/utils.py @@ -774,10 +774,7 @@ def validate_instance_info_traits(node): if not all(isinstance(t, six.string_types) for t in instance_traits): invalid() - # TODO(mgoddard): Remove the obj_attr_is_set() call in Rocky - # when all node objects will have a traits field. - node_traits = (node.traits.get_trait_names() - if node.obj_attr_is_set('traits') else []) + node_traits = node.traits.get_trait_names() missing = set(instance_traits) - set(node_traits) if missing: err = (_("Cannot specify instance traits that are not also set on the " diff --git a/ironic/tests/unit/conductor/test_utils.py b/ironic/tests/unit/conductor/test_utils.py index 4707c920e4..25a7f939a6 100644 --- a/ironic/tests/unit/conductor/test_utils.py +++ b/ironic/tests/unit/conductor/test_utils.py @@ -1814,11 +1814,3 @@ class ValidateInstanceInfoTraitsTestCase(tests_base.TestCase): 'Cannot specify instance traits that are not', conductor_utils.validate_instance_info_traits, self.node) - - def test_validate_instance_info_traits_no_node_traits(self): - self.node.instance_info['traits'] = ['trait1', 'trait2'] - delattr(self.node, 'traits') - self.assertRaisesRegex(exception.InvalidParameterValue, - 'Cannot specify instance traits that are not', - conductor_utils.validate_instance_info_traits, - self.node)