Skip to content

Commit fd99a7c

Browse files
committed
Fix error that cannot overwrite policy rule for 'forced_host'
When configure 'os_compute_api:servers:create:forced_host' to 'rule:admin_or_owner', but still doesn't allow. In nova/api/openstack/compute/servers.py#L669, the target is set to '{}' that is not equal None, so then it will not be set in nova/policy.py#L205. This patch configures the target param. Change-Id: I7a563386bd2f5d1930b5eb2cfc00425a19747e24 Closes-Bug: #1894975
1 parent 4f5f834 commit fd99a7c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

nova/api/openstack/compute/servers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,8 @@ def create(self, req, body):
666666
except exception.InvalidInput as err:
667667
raise exc.HTTPBadRequest(explanation=six.text_type(err))
668668
if host or node:
669-
context.can(server_policies.SERVERS % 'create:forced_host', {})
669+
context.can(server_policies.SERVERS % 'create:forced_host',
670+
target=target)
670671

671672
if api_version_request.is_supported(req, min_version='2.74'):
672673
self._process_hosts_for_create(context, target, server_dict,

0 commit comments

Comments
 (0)