summaryrefslogtreecommitdiff
path: root/openstackclient/identity/v3/project.py
diff options
context:
space:
mode:
authorTerry Howe <terrylhowe@gmail.com>2014-05-30 10:38:20 -0600
committerTerry Howe <thowe@hp.com>2014-07-07 20:18:39 +0000
commitb6384886973c652c0161a9caeac6f31066edace1 (patch)
treee2ed27fc511b9c64a4064c892d6e6d31e300ae50 /openstackclient/identity/v3/project.py
parentb3736fd9df869e2f2824ed831deb3aa9a446ee59 (diff)
downloadpython-openstackclient-b6384886973c652c0161a9caeac6f31066edace1.tar.gz
Domain administrator cannot do project operations
Domain administrator cannot do project operations because the require access to the domain API (which they don't have). When attempting to find a domain for project operations, ignore errors because the API returns nothing without indicating there is a problem. The domain administrators will have to use a domain id, but they will still be able to do project operations. If the user does not have permission to read the domain table, they cannot use domain names. Change-Id: Ieed5d420022a407c8296a0bb3569d9469c89d752 Closes-Bug: #1317478 Closes-Bug: #1317485
Diffstat (limited to 'openstackclient/identity/v3/project.py')
-rw-r--r--openstackclient/identity/v3/project.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/openstackclient/identity/v3/project.py b/openstackclient/identity/v3/project.py
index 00a98d19..fa935f0b 100644
--- a/openstackclient/identity/v3/project.py
+++ b/openstackclient/identity/v3/project.py
@@ -24,6 +24,7 @@ from cliff import show
from openstackclient.common import parseractions
from openstackclient.common import utils
+from openstackclient.identity import common
class CreateProject(show.ShowOne):
@@ -73,10 +74,7 @@ class CreateProject(show.ShowOne):
identity_client = self.app.client_manager.identity
if parsed_args.domain:
- domain = utils.find_resource(
- identity_client.domains,
- parsed_args.domain,
- ).id
+ domain = common.find_domain(identity_client, parsed_args.domain).id
else:
domain = None
@@ -156,10 +154,8 @@ class ListProject(lister.Lister):
columns = ('ID', 'Name')
kwargs = {}
if parsed_args.domain:
- kwargs['domain'] = utils.find_resource(
- identity_client.domains,
- parsed_args.domain,
- ).id
+ domain = common.find_domain(identity_client, parsed_args.domain)
+ kwargs['domain'] = domain.id
data = identity_client.projects.list(**kwargs)
return (columns,
(utils.get_item_properties(
@@ -236,10 +232,8 @@ class SetProject(command.Command):
if parsed_args.name:
kwargs['name'] = parsed_args.name
if parsed_args.domain:
- kwargs['domain'] = utils.find_resource(
- identity_client.domains,
- parsed_args.domain,
- ).id
+ domain = common.find_domain(identity_client, parsed_args.domain)
+ kwargs['domain'] = domain.id
if parsed_args.description:
kwargs['description'] = parsed_args.description
if parsed_args.enable: