Confusing log messages in project hierarchy checking

When is_domain is false, the project must contain a valid
domain_id and parent_id. We check the domain_id specified
is consistent with the domain of its parent.
The log messages is not very clear, this patch optimize it.

Change-Id: Ie83d295f036f94d36c9dfa88ae03e074cdfd9810
This commit is contained in:
zlyqqq 2017-07-07 02:37:20 +08:00 committed by zhengliuyang
parent b9b3b5c389
commit b5c3dec60f

View File

@ -114,19 +114,18 @@ class Manager(manager.Manager):
if parent_ref['is_domain']:
if parent_ref['id'] != domain['id']:
raise exception.ValidationError(
message=_('Cannot create project, since its parent '
'(%(domain_id)s) is acting as a domain, '
'but project\'s specified parent_id '
'(%(parent_id)s) does not match '
'this domain_id.')
% {'domain_id': domain['id'],
'parent_id': parent_ref['id']})
message=_('Cannot create project, the parent '
'(%(parent_id)s) is acting as a domain, '
'but this project\'s domain id (%(domain_id)s) '
'does not match the parent\'s id.')
% {'parent_id': parent_ref['id'],
'domain_id': domain['id']})
else:
parent_domain_id = parent_ref.get('domain_id')
if parent_domain_id != domain['id']:
raise exception.ValidationError(
message=_('Cannot create project, since it specifies '
'its owner as domain %(domain_id)s, but '
'its domain_id %(domain_id)s, but '
'specifies a parent in a different domain '
'(%(parent_domain_id)s).')
% {'domain_id': domain['id'],