summaryrefslogtreecommitdiff
path: root/openstackclient/identity/v3/role.py
diff options
context:
space:
mode:
authorMohan Muppidi <mkumar2301@gmail.com>2016-02-28 09:43:44 +0000
committerMohan Muppidi <mkumar2301@gmail.com>2016-02-29 17:23:29 +0000
commit3d7430463c733e1dfcf8487ce955abd863f9f617 (patch)
tree59af01ecbe0ab537a34488ca96fa8fe264a5b4a4 /openstackclient/identity/v3/role.py
parent2819450be5d4fa57c6efdb4cd225f59bab894fba (diff)
downloadpython-openstackclient-3d7430463c733e1dfcf8487ce955abd863f9f617.tar.gz
take_action() method from command.Command shouldn't return
command.Command and command.Showone are base classes implemented in cliff framework. Showone extends Command to allow take_action() to return data to be formatted using a user-selectable formatter. Most of the classes which are extended from Command in openstackclient/identity/v3/ in some cases return data or return nothing where it is not necessary, this commit fixes most of them. Change-Id: I84c72ea4d6680f8bdbef5449316dd9a8af8c8286 Closes-Bug: 1550892
Diffstat (limited to 'openstackclient/identity/v3/role.py')
-rw-r--r--openstackclient/identity/v3/role.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/openstackclient/identity/v3/role.py b/openstackclient/identity/v3/role.py
index 4cced611..1195ab21 100644
--- a/openstackclient/identity/v3/role.py
+++ b/openstackclient/identity/v3/role.py
@@ -123,7 +123,6 @@ class AddRole(command.Command):
if (not parsed_args.user and not parsed_args.domain
and not parsed_args.group and not parsed_args.project):
return
-
role = utils.find_resource(
identity_client.roles,
parsed_args.role,
@@ -138,7 +137,6 @@ class AddRole(command.Command):
return
identity_client.roles.grant(role.id, **kwargs)
- return
class CreateRole(command.ShowOne):
@@ -197,7 +195,6 @@ class DeleteRole(command.Command):
role,
)
identity_client.roles.delete(role_obj.id)
- return
class ListRole(command.Lister):
@@ -318,8 +315,10 @@ class RemoveRole(command.Command):
if (not parsed_args.user and not parsed_args.domain
and not parsed_args.group and not parsed_args.project):
+ sys.stderr.write("Incorrect set of arguments "
+ "provided. See openstack --help for more "
+ "details\n")
return
-
role = utils.find_resource(
identity_client.roles,
parsed_args.role,
@@ -331,9 +330,7 @@ class RemoveRole(command.Command):
sys.stderr.write("Role not removed, incorrect set of arguments \
provided. See openstack --help for more details\n")
return
-
identity_client.roles.revoke(role.id, **kwargs)
- return
class SetRole(command.Command):
@@ -357,15 +354,16 @@ class SetRole(command.Command):
identity_client = self.app.client_manager.identity
if not parsed_args.name:
+ sys.stderr.write("Incorrect set of arguments "
+ "provided. See openstack --help for more "
+ "details\n")
return
-
role = utils.find_resource(
identity_client.roles,
parsed_args.role,
)
identity_client.roles.update(role.id, name=parsed_args.name)
- return
class ShowRole(command.ShowOne):