From 3e235b2b510199a58bc3e19290ad42fd0aa5e289 Mon Sep 17 00:00:00 2001 From: Tovin Seven Date: Mon, 19 Jun 2017 10:09:48 +0700 Subject: [PATCH] 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 Change-Id: Ia9b469024395327ec0ee082ddaea3234fc3ca5a6 --- README.rst | 1 + cinderclient/shell.py | 4 +++- .../profile-as-environment-variable-2a5c666ef759e486.yaml | 6 ++++++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/profile-as-environment-variable-2a5c666ef759e486.yaml diff --git a/README.rst b/README.rst index c9fe419b0..c79ef066b 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 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 d36294b84..6d2a83565 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 000000000..76fcd9d3f --- /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.