remove unnecessary conditionals
In several places we had else branches where a reasonable default would do the job. This makes the code a mean cleaer and easier to read. Change-Id: I231e09aab85fd32b8300bc33c48d0899b728b96e
This commit is contained in:
parent
fd8b284164
commit
00eeb3593c
openstackclient/identity/v3
@ -137,11 +137,11 @@ class CreateGroup(show.ShowOne):
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('take_action(%s)', parsed_args)
|
||||
identity_client = self.app.client_manager.identity
|
||||
|
||||
domain = None
|
||||
if parsed_args.domain:
|
||||
domain = common.find_domain(identity_client,
|
||||
parsed_args.domain).id
|
||||
else:
|
||||
domain = None
|
||||
|
||||
try:
|
||||
group = identity_client.groups.create(
|
||||
@ -228,11 +228,10 @@ class ListGroup(lister.Lister):
|
||||
self.log.debug('take_action(%s)', parsed_args)
|
||||
identity_client = self.app.client_manager.identity
|
||||
|
||||
domain = None
|
||||
if parsed_args.domain:
|
||||
domain = common.find_domain(identity_client,
|
||||
parsed_args.domain).id
|
||||
else:
|
||||
domain = None
|
||||
|
||||
if parsed_args.user:
|
||||
user = utils.find_resource(
|
||||
|
@ -80,11 +80,10 @@ class CreateProject(show.ShowOne):
|
||||
self.log.debug('take_action(%s)', parsed_args)
|
||||
identity_client = self.app.client_manager.identity
|
||||
|
||||
domain = None
|
||||
if parsed_args.domain:
|
||||
domain = common.find_domain(identity_client,
|
||||
parsed_args.domain).id
|
||||
else:
|
||||
domain = None
|
||||
|
||||
enabled = True
|
||||
if parsed_args.disable:
|
||||
|
@ -92,23 +92,20 @@ class CreateTrust(show.ShowOne):
|
||||
self.log.debug('take_action(%s)' % parsed_args)
|
||||
identity_client = self.app.client_manager.identity
|
||||
|
||||
project_domain = None
|
||||
if parsed_args.project_domain:
|
||||
project_domain = common.find_domain(identity_client,
|
||||
parsed_args.project_domain).id
|
||||
else:
|
||||
project_domain = None
|
||||
|
||||
trustor_domain = None
|
||||
if parsed_args.trustor_domain:
|
||||
trustor_domain = common.find_domain(identity_client,
|
||||
parsed_args.trustor_domain).id
|
||||
else:
|
||||
trustor_domain = None
|
||||
|
||||
trustee_domain = None
|
||||
if parsed_args.trustee_domain:
|
||||
trustee_domain = common.find_domain(identity_client,
|
||||
parsed_args.trustee_domain).id
|
||||
else:
|
||||
trustee_domain = None
|
||||
|
||||
# NOTE(stevemar): Find the two users, project and roles that
|
||||
# are necessary for making a trust usable, the API dictates that
|
||||
|
@ -94,19 +94,17 @@ class CreateUser(show.ShowOne):
|
||||
self.log.debug('take_action(%s)', parsed_args)
|
||||
identity_client = self.app.client_manager.identity
|
||||
|
||||
project_id = None
|
||||
if parsed_args.project:
|
||||
project_id = utils.find_resource(
|
||||
identity_client.projects,
|
||||
parsed_args.project,
|
||||
).id
|
||||
else:
|
||||
project_id = None
|
||||
|
||||
domain_id = None
|
||||
if parsed_args.domain:
|
||||
domain_id = common.find_domain(identity_client,
|
||||
parsed_args.domain).id
|
||||
else:
|
||||
domain_id = None
|
||||
|
||||
enabled = True
|
||||
if parsed_args.disable:
|
||||
@ -211,11 +209,10 @@ class ListUser(lister.Lister):
|
||||
self.log.debug('take_action(%s)', parsed_args)
|
||||
identity_client = self.app.client_manager.identity
|
||||
|
||||
domain = None
|
||||
if parsed_args.domain:
|
||||
domain = common.find_domain(identity_client,
|
||||
parsed_args.domain).id
|
||||
else:
|
||||
domain = None
|
||||
|
||||
if parsed_args.group:
|
||||
group = utils.find_resource(
|
||||
|
Loading…
x
Reference in New Issue
Block a user