From c0f88d5fc0fd947319e022cfeba21bcb15635316 Mon Sep 17 00:00:00 2001 From: Tovin Seven Date: Mon, 19 Jun 2017 10:13:07 +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. Correct/update help text. Co-Authored-By: Hieu LE Change-Id: I67c1e4b859b972e380eb658c98ceae4fbef5c254 --- doc/source/cli/details.rst | 8 ++++---- glanceclient/shell.py | 12 +++++++----- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/doc/source/cli/details.rst b/doc/source/cli/details.rst index f303c09b..efc2a336 100644 --- a/doc/source/cli/details.rst +++ b/doc/source/cli/details.rst @@ -100,11 +100,11 @@ glance optional arguments HMAC key to use for encrypting context data for performance profiling of operation. This key should be the value of HMAC key configured in osprofiler - middleware in glance, it is specified in paste - configuration file at /etc/glance/api-paste.ini and - /etc/glance/registry-paste.ini. Without key the + middleware in glance, it is specified in glance + configuration file at /etc/glance/glance-api.conf and + /etc/glance/glance-registry.conf. Without key the profiling will not be triggered even if osprofiler is - enabled on server side. + enabled on server side. Defaults to ``env[OS_PROFILE]``. ``--key-file OS_KEY`` **DEPRECATED!** Use --os-key. diff --git a/glanceclient/shell.py b/glanceclient/shell.py index 5aaaf394..fae9e4a1 100644 --- a/glanceclient/shell.py +++ b/glanceclient/shell.py @@ -192,16 +192,18 @@ class OpenStackImagesShell(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 should be the value of HMAC key ' 'configured in osprofiler middleware in ' - 'glance, it is specified in paste ' + 'glance, it is specified in glance ' 'configuration file at ' - '/etc/glance/api-paste.ini and ' - '/etc/glance/registry-paste.ini. Without key ' - 'the profiling will not be triggered even ' - 'if osprofiler is enabled on server side.') + '/etc/glance/glance-api.conf and ' + '/etc/glance/glance-registry.conf. Without ' + 'key the profiling will not be triggered even ' + 'if osprofiler is enabled on server side. ' + 'Defaults to env[OS_PROFILE].') self._append_global_identity_args(parser, argv)