Clean up nits from adding additional node update policies
This patch resolves some minor nits. Change-Id: I47f301cb4cdc8de158fa52aad35b7136d1356b93
This commit is contained in:
parent
392f2a56bf
commit
6e99015836
@ -2124,7 +2124,7 @@ class NodesController(rest.RestController):
|
|||||||
generic_update = True
|
generic_update = True
|
||||||
|
|
||||||
# always do at least one check
|
# always do at least one check
|
||||||
if generic_update or policy_checks == []:
|
if generic_update or not policy_checks:
|
||||||
policy_checks.append('baremetal:node:update')
|
policy_checks.append('baremetal:node:update')
|
||||||
|
|
||||||
rpc_node = api_utils.check_multiple_node_policies_and_retrieve(
|
rpc_node = api_utils.check_multiple_node_policies_and_retrieve(
|
||||||
|
@ -3400,7 +3400,8 @@ class TestPatch(test_api_base.BaseApiTest):
|
|||||||
self.assertEqual('application/json', response.content_type)
|
self.assertEqual('application/json', response.content_type)
|
||||||
self.assertEqual(http_client.NOT_ACCEPTABLE, response.status_code)
|
self.assertEqual(http_client.NOT_ACCEPTABLE, response.status_code)
|
||||||
|
|
||||||
@mock.patch.object(api_utils, 'check_multiple_node_policies_and_retrieve')
|
@mock.patch.object(api_utils, 'check_multiple_node_policies_and_retrieve',
|
||||||
|
autospec=True)
|
||||||
def test_patch_policy_update(self, mock_cmnpar):
|
def test_patch_policy_update(self, mock_cmnpar):
|
||||||
node = obj_utils.create_test_node(self.context,
|
node = obj_utils.create_test_node(self.context,
|
||||||
uuid=uuidutils.generate_uuid())
|
uuid=uuidutils.generate_uuid())
|
||||||
@ -3417,7 +3418,8 @@ class TestPatch(test_api_base.BaseApiTest):
|
|||||||
mock_cmnpar.assert_called_once_with(
|
mock_cmnpar.assert_called_once_with(
|
||||||
['baremetal:node:update'], node.uuid, with_suffix=True)
|
['baremetal:node:update'], node.uuid, with_suffix=True)
|
||||||
|
|
||||||
@mock.patch.object(api_utils, 'check_multiple_node_policies_and_retrieve')
|
@mock.patch.object(api_utils, 'check_multiple_node_policies_and_retrieve',
|
||||||
|
autospec=True)
|
||||||
def test_patch_policy_update_none(self, mock_cmnpar):
|
def test_patch_policy_update_none(self, mock_cmnpar):
|
||||||
node = obj_utils.create_test_node(self.context,
|
node = obj_utils.create_test_node(self.context,
|
||||||
uuid=uuidutils.generate_uuid())
|
uuid=uuidutils.generate_uuid())
|
||||||
@ -3432,7 +3434,8 @@ class TestPatch(test_api_base.BaseApiTest):
|
|||||||
mock_cmnpar.assert_called_once_with(
|
mock_cmnpar.assert_called_once_with(
|
||||||
['baremetal:node:update'], node.uuid, with_suffix=True)
|
['baremetal:node:update'], node.uuid, with_suffix=True)
|
||||||
|
|
||||||
@mock.patch.object(api_utils, 'check_multiple_node_policies_and_retrieve')
|
@mock.patch.object(api_utils, 'check_multiple_node_policies_and_retrieve',
|
||||||
|
autospec=True)
|
||||||
def test_patch_policy_update_extra(self, mock_cmnpar):
|
def test_patch_policy_update_extra(self, mock_cmnpar):
|
||||||
node = obj_utils.create_test_node(self.context,
|
node = obj_utils.create_test_node(self.context,
|
||||||
uuid=uuidutils.generate_uuid())
|
uuid=uuidutils.generate_uuid())
|
||||||
@ -3449,7 +3452,8 @@ class TestPatch(test_api_base.BaseApiTest):
|
|||||||
mock_cmnpar.assert_called_once_with(
|
mock_cmnpar.assert_called_once_with(
|
||||||
['baremetal:node:update_extra'], node.uuid, with_suffix=True)
|
['baremetal:node:update_extra'], node.uuid, with_suffix=True)
|
||||||
|
|
||||||
@mock.patch.object(api_utils, 'check_multiple_node_policies_and_retrieve')
|
@mock.patch.object(api_utils, 'check_multiple_node_policies_and_retrieve',
|
||||||
|
autospec=True)
|
||||||
def test_patch_policy_update_instance_info(self, mock_cmnpar):
|
def test_patch_policy_update_instance_info(self, mock_cmnpar):
|
||||||
node = obj_utils.create_test_node(self.context,
|
node = obj_utils.create_test_node(self.context,
|
||||||
uuid=uuidutils.generate_uuid())
|
uuid=uuidutils.generate_uuid())
|
||||||
@ -3467,7 +3471,8 @@ class TestPatch(test_api_base.BaseApiTest):
|
|||||||
['baremetal:node:update_instance_info'],
|
['baremetal:node:update_instance_info'],
|
||||||
node.uuid, with_suffix=True)
|
node.uuid, with_suffix=True)
|
||||||
|
|
||||||
@mock.patch.object(api_utils, 'check_multiple_node_policies_and_retrieve')
|
@mock.patch.object(api_utils, 'check_multiple_node_policies_and_retrieve',
|
||||||
|
autospec=True)
|
||||||
def test_patch_policy_update_generic_and_extra(self, mock_cmnpar):
|
def test_patch_policy_update_generic_and_extra(self, mock_cmnpar):
|
||||||
node = obj_utils.create_test_node(self.context,
|
node = obj_utils.create_test_node(self.context,
|
||||||
uuid=uuidutils.generate_uuid())
|
uuid=uuidutils.generate_uuid())
|
||||||
@ -3488,7 +3493,8 @@ class TestPatch(test_api_base.BaseApiTest):
|
|||||||
['baremetal:node:update_extra', 'baremetal:node:update'],
|
['baremetal:node:update_extra', 'baremetal:node:update'],
|
||||||
node.uuid, with_suffix=True)
|
node.uuid, with_suffix=True)
|
||||||
|
|
||||||
@mock.patch.object(api_utils, 'check_multiple_node_policies_and_retrieve')
|
@mock.patch.object(api_utils, 'check_multiple_node_policies_and_retrieve',
|
||||||
|
autospec=True)
|
||||||
def test_patch_policy_update_generic_and_instance_info(self, mock_cmnpar):
|
def test_patch_policy_update_generic_and_instance_info(self, mock_cmnpar):
|
||||||
node = obj_utils.create_test_node(self.context,
|
node = obj_utils.create_test_node(self.context,
|
||||||
uuid=uuidutils.generate_uuid())
|
uuid=uuidutils.generate_uuid())
|
||||||
@ -3509,7 +3515,8 @@ class TestPatch(test_api_base.BaseApiTest):
|
|||||||
['baremetal:node:update_instance_info', 'baremetal:node:update'],
|
['baremetal:node:update_instance_info', 'baremetal:node:update'],
|
||||||
node.uuid, with_suffix=True)
|
node.uuid, with_suffix=True)
|
||||||
|
|
||||||
@mock.patch.object(api_utils, 'check_multiple_node_policies_and_retrieve')
|
@mock.patch.object(api_utils, 'check_multiple_node_policies_and_retrieve',
|
||||||
|
autospec=True)
|
||||||
def test_patch_policy_update_extra_and_instance_info(self, mock_cmnpar):
|
def test_patch_policy_update_extra_and_instance_info(self, mock_cmnpar):
|
||||||
node = obj_utils.create_test_node(self.context,
|
node = obj_utils.create_test_node(self.context,
|
||||||
uuid=uuidutils.generate_uuid())
|
uuid=uuidutils.generate_uuid())
|
||||||
@ -3531,7 +3538,8 @@ class TestPatch(test_api_base.BaseApiTest):
|
|||||||
'baremetal:node:update_instance_info'],
|
'baremetal:node:update_instance_info'],
|
||||||
node.uuid, with_suffix=True)
|
node.uuid, with_suffix=True)
|
||||||
|
|
||||||
@mock.patch.object(api_utils, 'check_multiple_node_policies_and_retrieve')
|
@mock.patch.object(api_utils, 'check_multiple_node_policies_and_retrieve',
|
||||||
|
autospec=True)
|
||||||
def test_patch_policy_update_generic_extra_instance_info(
|
def test_patch_policy_update_generic_extra_instance_info(
|
||||||
self, mock_cmnpar):
|
self, mock_cmnpar):
|
||||||
node = obj_utils.create_test_node(self.context,
|
node = obj_utils.create_test_node(self.context,
|
||||||
|
@ -4,5 +4,5 @@ features:
|
|||||||
Adds ``baremetal:node:update_extra`` and ``baremetal:node:instance_info``
|
Adds ``baremetal:node:update_extra`` and ``baremetal:node:instance_info``
|
||||||
policies to allow finer-grained policy control over node updates. In order
|
policies to allow finer-grained policy control over node updates. In order
|
||||||
to use standalone Ironic to provision a node, a user must be able to
|
to use standalone Ironic to provision a node, a user must be able to
|
||||||
update these attributes, and a lessee should not be able to update all
|
update ``instance_info`` (and ``extra`` if using metalsmith), and a lessee
|
||||||
node attributes.
|
should not be able to update all node attributes.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user