Include project_id in the validation error on default project is domain

Include the project_id in the validation error message when the default
project is trying to be set to a domain.

Change-Id: I0f4ba70e776072e91e3e50db53e86ddd21c32a82
This commit is contained in:
Morgan Fainberg 2016-05-20 22:28:35 +00:00
parent 8a7133f950
commit e26b806414
1 changed files with 4 additions and 2 deletions

View File

@ -834,8 +834,10 @@ class Manager(manager.Manager):
try:
project_ref = self.resource_api.get_project(default_project_id)
if project_ref['is_domain'] is True:
msg = _("User's default project ID cannot be a domain ID.")
raise exception.ValidationError(message=msg)
msg = _("User's default project ID cannot be a "
"domain ID: %s")
raise exception.ValidationError(
message=(msg % default_project_id))
except exception.ProjectNotFound:
# should be idempotent if project is not found so that it is
# backward compatible