From 9f87bafca2801962f8eb0c128e3e83341e7d2fe8 Mon Sep 17 00:00:00 2001 From: Samuel de Medeiros Queiroz Date: Wed, 31 Dec 2014 15:57:05 -0300 Subject: [PATCH] Fix error message on check on RoleV3 The error message on validation of targets and actors was wrong. This patch fixes this. Closes-Bug: 1406938 Change-Id: I074f65c23212df9b66c7dfc65d9ad71ea0de9ed8 --- keystone/assignment/controllers.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/keystone/assignment/controllers.py b/keystone/assignment/controllers.py index 5be6ab6400..1b9a5cc0fa 100644 --- a/keystone/assignment/controllers.py +++ b/keystone/assignment/controllers.py @@ -495,14 +495,20 @@ class RoleV3(controller.V3Controller): self.role_api.delete_role(role_id) def _require_domain_xor_project(self, domain_id, project_id): - if (domain_id and project_id) or (not domain_id and not project_id): + if domain_id and project_id: msg = _('Specify a domain or project, not both') raise exception.ValidationError(msg) + if not domain_id and not project_id: + msg = _('Specify one of domain or project') + raise exception.ValidationError(msg) def _require_user_xor_group(self, user_id, group_id): - if (user_id and group_id) or (not user_id and not group_id): + if user_id and group_id: msg = _('Specify a user or group, not both') raise exception.ValidationError(msg) + if not user_id and not group_id: + msg = _('Specify one of user or group') + raise exception.ValidationError(msg) def _check_if_inherited(self, context): return (CONF.os_inherit.enabled and