summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoisés Guimarães de Medeiros <moguimar@redhat.com>2019-01-03 16:37:38 +0100
committerMoisés Guimarães de Medeiros <moguimar@redhat.com>2019-01-03 16:37:38 +0100
commit3180feed53641d9a1b76dd1526dbcadda168412d (patch)
treecb7cba60644c01580e8e770ffbb9de5e4b14f79d
parent48f963b29eac2f7da2b1fd68b1955c2735caa21a (diff)
downloadoslo-policy-3180feed53641d9a1b76dd1526dbcadda168412d.tar.gz
Fixes is_admin type from StrOpt to BoolOpt.
oslo.config already has a proper type to deal with boolean options. Change-Id: I675c1dbfa13ca68506042f7907082b0e3d51672a Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
-rw-r--r--oslo_policy/shell.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/oslo_policy/shell.py b/oslo_policy/shell.py
index 56f5cce..dcf8f2e 100644
--- a/oslo_policy/shell.py
+++ b/oslo_policy/shell.py
@@ -95,13 +95,13 @@ def main():
conf.register_cli_opt(cfg.StrOpt(
'policy',
required=True,
- help='path to a policy file'))
+ help='path to a policy file.'))
conf.register_cli_opt(cfg.StrOpt(
'access',
required=True,
help='path to a file containing OpenStack Identity API '
- 'access info in JSON format'))
+ 'access info in JSON format.'))
conf.register_cli_opt(cfg.StrOpt(
'target',
@@ -110,18 +110,16 @@ def main():
conf.register_cli_opt(cfg.StrOpt(
'rule',
- help='rule to test'))
+ help='rule to test.'))
- conf.register_cli_opt(cfg.StrOpt(
+ conf.register_cli_opt(cfg.BoolOpt(
'is_admin',
- help='set is_admin=True on the credentials used for the evaluation',
- default=""))
+ help='set is_admin=True on the credentials used for the evaluation.',
+ default=False))
conf()
- is_admin = conf.is_admin.lower() == "true"
-
- tool(conf.policy, conf.access, conf.rule, is_admin, conf.target)
+ tool(conf.policy, conf.access, conf.rule, conf.is_admin, conf.target)
if __name__ == "__main__":