summaryrefslogtreecommitdiff
path: root/openstackclient/identity/v3/policy.py
diff options
context:
space:
mode:
authorStephen Finucane <sfinucan@redhat.com>2023-05-08 11:32:01 +0100
committerStephen Finucane <sfinucan@redhat.com>2023-05-10 10:51:30 +0100
commitaed521d426f45b335e1c69d8b2f6d103c916f75c (patch)
tree39eca8c658a0339cfbbe3b0e9e69232037be17f6 /openstackclient/identity/v3/policy.py
parent6475dc58e8baa199d948c4b2d250c1fb45e0bd30 (diff)
downloadpython-openstackclient-aed521d426f45b335e1c69d8b2f6d103c916f75c.tar.gz
Blacken openstackclient.identity
Black used with the '-l 79 -S' flags. A future change will ignore this commit in git-blame history by adding a 'git-blame-ignore-revs' file. Change-Id: I2eeade1ce6653be8e9179ecc40105182c5ff5f16 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Diffstat (limited to 'openstackclient/identity/v3/policy.py')
-rw-r--r--openstackclient/identity/v3/policy.py40
1 files changed, 28 insertions, 12 deletions
diff --git a/openstackclient/identity/v3/policy.py b/openstackclient/identity/v3/policy.py
index 45674210..2504a467 100644
--- a/openstackclient/identity/v3/policy.py
+++ b/openstackclient/identity/v3/policy.py
@@ -36,8 +36,10 @@ class CreatePolicy(command.ShowOne):
'--type',
metavar='<type>',
default="application/json",
- help=_('New MIME type of the policy rules file '
- '(defaults to application/json)'),
+ help=_(
+ 'New MIME type of the policy rules file '
+ '(defaults to application/json)'
+ ),
)
parser.add_argument(
'rules',
@@ -80,13 +82,20 @@ class DeletePolicy(command.Command):
identity_client.policies.delete(i)
except Exception as e:
result += 1
- LOG.error(_("Failed to delete policy with name or "
- "ID '%(policy)s': %(e)s"), {'policy': i, 'e': e})
+ LOG.error(
+ _(
+ "Failed to delete policy with name or "
+ "ID '%(policy)s': %(e)s"
+ ),
+ {'policy': i, 'e': e},
+ )
if result > 0:
total = len(parsed_args.policy)
- msg = (_("%(result)s of %(total)s policys failed "
- "to delete.") % {'result': result, 'total': total})
+ msg = _("%(result)s of %(total)s policys failed " "to delete.") % {
+ 'result': result,
+ 'total': total,
+ }
raise exceptions.CommandError(msg)
@@ -111,11 +120,17 @@ class ListPolicy(command.Lister):
columns = ('ID', 'Type')
column_headers = columns
data = self.app.client_manager.identity.policies.list()
- return (column_headers,
- (utils.get_item_properties(
- s, columns,
+ return (
+ column_headers,
+ (
+ utils.get_item_properties(
+ s,
+ columns,
formatters={},
- ) for s in data))
+ )
+ for s in data
+ ),
+ )
class SetPolicy(command.Command):
@@ -170,8 +185,9 @@ class ShowPolicy(command.ShowOne):
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
- policy = utils.find_resource(identity_client.policies,
- parsed_args.policy)
+ policy = utils.find_resource(
+ identity_client.policies, parsed_args.policy
+ )
policy._info.pop('links')
policy._info.update({'rules': policy._info.pop('blob')})