Skip to content
This repository was archived by the owner on Nov 19, 2018. It is now read-only.

Commit 4639148

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Rename --profile to --os-profile"
2 parents 6cbbcfa + 530fe42 commit 4639148

4 files changed

Lines changed: 44 additions & 17 deletions

File tree

doc/source/man/openstack.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ OPTIONS
129129
:option:`--os-interface` <interface>
130130
Interface type. Valid options are `public`, `admin` and `internal`.
131131

132-
:option: `--profile` <hmac-key>
133-
HMAC key to use for encrypting context data for performance profiling of
134-
requested operation. This key should be the value of one of the HMAC keys
135-
defined in the configuration files of OpenStack services, user would like
136-
to trace through.
132+
:option:`--os-profile` <hmac-key>
133+
Performance profiling HMAC key for encrypting context data
134+
135+
This key should be the value of one of the HMAC keys defined in the
136+
configuration files of OpenStack services to be traced.
137137

138138
:option:`--log-file` <LOGFILE>
139139
Specify a file to log output. Disabled by default.

openstackclient/shell.py

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
"""Command-line interface to the OpenStack APIs"""
1818

19+
import argparse
1920
import getpass
2021
import logging
2122
import sys
@@ -131,6 +132,16 @@ def run(self, argv):
131132
self.log.info("END return value: %s", ret_val)
132133

133134
def init_profile(self):
135+
# NOTE(dtroyer): Remove this 'if' block when the --profile global
136+
# option is removed
137+
if osprofiler_profiler and self.options.old_profile:
138+
self.log.warning(
139+
'The --profile option is deprecated, '
140+
'please use --os-profile instead'
141+
)
142+
if not self.options.profile:
143+
self.options.profile = self.options.old_profile
144+
134145
self.do_profile = osprofiler_profiler and self.options.profile
135146
if self.do_profile:
136147
osprofiler_profiler.init(self.options.profile)
@@ -144,7 +155,7 @@ def close_profile(self):
144155
# bigger than most big default one (CRITICAL) or something like
145156
# that (PROFILE = 60 for instance), but not sure we need it here.
146157
self.log.warning("Trace ID: %s" % trace_id)
147-
self.log.warning("To display trace use next command:\n"
158+
self.log.warning("Display trace with command:\n"
148159
"osprofiler trace show --html %s " % trace_id)
149160

150161
def run_subcommand(self, argv):
@@ -242,16 +253,22 @@ def build_option_parser(self, description, version):
242253

243254
# osprofiler HMAC key argument
244255
if osprofiler_profiler:
245-
parser.add_argument('--profile',
246-
metavar='hmac-key',
247-
help='HMAC key to use for encrypting context '
248-
'data for performance profiling of operation. '
249-
'This key should be the value of one of the '
250-
'HMAC keys configured in osprofiler '
251-
'middleware in the projects user would like '
252-
'to profile. It needs to be specified in '
253-
'configuration files of the required '
254-
'projects.')
256+
parser.add_argument(
257+
'--os-profile',
258+
metavar='hmac-key',
259+
dest='profile',
260+
help='HMAC key for encrypting profiling context data',
261+
)
262+
# NOTE(dtroyer): This global option should have been named
263+
# --os-profile as --profile interferes with at
264+
# least one existing command option. Deprecate
265+
# --profile and remove after Apr 2017.
266+
parser.add_argument(
267+
'--profile',
268+
metavar='hmac-key',
269+
dest='old_profile',
270+
help=argparse.SUPPRESS,
271+
)
255272

256273
return clientmanager.build_plugin_option_parser(parser)
257274

openstackclient/tests/test_shell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
'--os-default-domain': (DEFAULT_DOMAIN_NAME, True, True),
113113
'--os-cacert': ('/dev/null', True, True),
114114
'--timing': (True, True, False),
115-
'--profile': ('SECRET_KEY', True, False),
115+
'--os-profile': ('SECRET_KEY', True, False),
116116
'--os-interface': (DEFAULT_INTERFACE, True, True)
117117
}
118118

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
upgrade:
3+
- |
4+
Deprecate global option ``--profile`` in favor of ``--os-profile``.
5+
6+
``--profile`` interferes with existing command options with the same name.
7+
Unfortunately it appeared in a release so we must follow the deprecation
8+
process and wait one year (April 2017) before removing it.
9+
10+
[Bug `1571812 <https://bugs.launchpad.net/python-openstackclient/+bug/1571812>`_]

0 commit comments

Comments
 (0)