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 <hieulq@vn.fujitsu.com>
Change-Id: I67c1e4b859b972e380eb658c98ceae4fbef5c254
This commit is contained in:
Tovin Seven 2017-06-19 10:13:07 +07:00
parent a6e0cdf46d
commit c0f88d5fc0
2 changed files with 11 additions and 9 deletions

View File

@ -100,11 +100,11 @@ glance optional arguments
HMAC key to use for encrypting context data for HMAC key to use for encrypting context data for
performance profiling of operation. This key should be performance profiling of operation. This key should be
the value of HMAC key configured in osprofiler the value of HMAC key configured in osprofiler
middleware in glance, it is specified in paste middleware in glance, it is specified in glance
configuration file at /etc/glance/api-paste.ini and configuration file at /etc/glance/glance-api.conf and
/etc/glance/registry-paste.ini. Without key the /etc/glance/glance-registry.conf. Without key the
profiling will not be triggered even if osprofiler is 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`` ``--key-file OS_KEY``
**DEPRECATED!** Use --os-key. **DEPRECATED!** Use --os-key.

View File

@ -192,16 +192,18 @@ class OpenStackImagesShell(object):
if osprofiler_profiler: if osprofiler_profiler:
parser.add_argument('--profile', parser.add_argument('--profile',
metavar='HMAC_KEY', metavar='HMAC_KEY',
default=utils.env('OS_PROFILE'),
help='HMAC key to use for encrypting context ' help='HMAC key to use for encrypting context '
'data for performance profiling of operation. ' 'data for performance profiling of operation. '
'This key should be the value of HMAC key ' 'This key should be the value of HMAC key '
'configured in osprofiler middleware in ' 'configured in osprofiler middleware in '
'glance, it is specified in paste ' 'glance, it is specified in glance '
'configuration file at ' 'configuration file at '
'/etc/glance/api-paste.ini and ' '/etc/glance/glance-api.conf and '
'/etc/glance/registry-paste.ini. Without key ' '/etc/glance/glance-registry.conf. Without '
'the profiling will not be triggered even ' 'key the profiling will not be triggered even '
'if osprofiler is enabled on server side.') 'if osprofiler is enabled on server side. '
'Defaults to env[OS_PROFILE].')
self._append_global_identity_args(parser, argv) self._append_global_identity_args(parser, argv)