summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTovin Seven <vinhnt@vn.fujitsu.com>2017-06-19 10:09:48 +0700
committerTovin Seven <vinhnt@vn.fujitsu.com>2017-07-27 01:33:05 +0000
commit3e235b2b510199a58bc3e19290ad42fd0aa5e289 (patch)
tree6e5af40ddf3184324a9cb30756735667c764e8d6
parent2d5e3a7aaf7e5a333aaa527111c06b53823956b2 (diff)
downloadpython-cinderclient-3e235b2b510199a58bc3e19290ad42fd0aa5e289.tar.gz
Make --profile load from environment variables
--profile argument can be loaded from OS_PROFILE environment variables to avoid repeating --profile in client commands. Co-Authored-By: Hieu LE <hieulq@vn.fujitsu.com> Change-Id: Ia9b469024395327ec0ee082ddaea3234fc3ca5a6
-rw-r--r--README.rst1
-rw-r--r--cinderclient/shell.py4
-rw-r--r--releasenotes/notes/profile-as-environment-variable-2a5c666ef759e486.yaml6
3 files changed, 10 insertions, 1 deletions
diff --git a/README.rst b/README.rst
index c9fe419..c79ef06 100644
--- a/README.rst
+++ b/README.rst
@@ -289,6 +289,7 @@ You'll find complete documentation on the shell by running
match the one configured on the cinder api server.
Without key the profiling will not be triggered even
if osprofiler is enabled on server side.
+ Defaults to env[OS_PROFILE].
--os-auth-strategy <auth-strategy>
Authentication strategy (Env: OS_AUTH_STRATEGY,
default keystone). For now, any other value will
diff --git a/cinderclient/shell.py b/cinderclient/shell.py
index d36294b..6d2a835 100644
--- a/cinderclient/shell.py
+++ b/cinderclient/shell.py
@@ -240,13 +240,15 @@ class OpenStackCinderShell(object):
if osprofiler_profiler:
parser.add_argument('--profile',
metavar='HMAC_KEY',
+ default=utils.env('OS_PROFILE'),
help=_('HMAC key to use for encrypting '
'context data for performance profiling '
'of operation. This key needs to match the '
'one configured on the cinder api server. '
'Without key the profiling will not be '
'triggered even if osprofiler is enabled '
- 'on server side.'))
+ 'on server side. Defaults to '
+ 'env[OS_PROFILE].'))
self._append_global_identity_args(parser)
diff --git a/releasenotes/notes/profile-as-environment-variable-2a5c666ef759e486.yaml b/releasenotes/notes/profile-as-environment-variable-2a5c666ef759e486.yaml
new file mode 100644
index 0000000..76fcd9d
--- /dev/null
+++ b/releasenotes/notes/profile-as-environment-variable-2a5c666ef759e486.yaml
@@ -0,0 +1,6 @@
+---
+features:
+ - |
+ ``--profile`` argument can be loaded from ``OS_PROFILE``
+ environment variable to avoid repeating ``--profile``
+ in openstack commands.