diff options
| author | Jenkins <jenkins@review.openstack.org> | 2016-05-25 00:08:55 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2016-05-25 00:08:55 +0000 |
| commit | e45b1c63f40b4e94e43bec71b44f00e4143fe9af (patch) | |
| tree | d69402dc9874e9b3e9ed0e00a3d2891fea03cf8f | |
| parent | 2402dcfc35990a1af5456ff4f3e4b0b261b1505a (diff) | |
| parent | 1a2e12832db6f3871c2c9356ff7b017dcb23a672 (diff) | |
| download | python-openstackclient-e45b1c63f40b4e94e43bec71b44f00e4143fe9af.tar.gz | |
Merge "Devref: Command Beta"
| -rw-r--r-- | doc/source/backwards-incompatible.rst | 3 | ||||
| -rw-r--r-- | doc/source/command-beta.rst | 72 | ||||
| -rw-r--r-- | doc/source/index.rst | 1 | ||||
| -rw-r--r-- | doc/source/man/openstack.rst | 3 | ||||
| -rw-r--r-- | openstackclient/shell.py | 5 |
5 files changed, 84 insertions, 0 deletions
diff --git a/doc/source/backwards-incompatible.rst b/doc/source/backwards-incompatible.rst index 4b90d6e1..00b314a5 100644 --- a/doc/source/backwards-incompatible.rst +++ b/doc/source/backwards-incompatible.rst @@ -10,6 +10,9 @@ Should positional arguments for a command need to change, the OpenStackClient team attempts to make the transition as painless as possible. Look for deprecation warnings that indicate the new commands (or options) to use. +Commands labeled as a beta according to :doc:`command-beta` are exempt from +this backwards incompatible change handling. + List of Backwards Incompatible Changes ====================================== diff --git a/doc/source/command-beta.rst b/doc/source/command-beta.rst new file mode 100644 index 00000000..53a44204 --- /dev/null +++ b/doc/source/command-beta.rst @@ -0,0 +1,72 @@ +============ +Command Beta +============ + +OpenStackClient releases do not always coincide with OpenStack +releases. This creates challenges when developing new OpenStackClient +commands for the current OpenStack release under development +since there may not be an official release of the REST API +enhancements necessary for the command. In addition, backwards +compatibility may not be guaranteed until an official OpenStack release. +To address these challenges, an OpenStackClient command may +be labeled as a beta command according to the guidelines +below. Such commands may introduce backwards incompatible +changes and may use REST API enhancements not yet released. + +See the examples below on how to label a command as a beta +by updating the command documentation, help and implementation. + +The initial release note must label the new command as a beta. +No further release notes are required until the command +is no longer a beta. At which time, the command beta label +or the command itself must be removed and a new release note +must be provided. + +Documentation +------------- + +The command documentation must label the command as a beta. + +example list +~~~~~~~~~~~~ + +List examples + +.. caution:: This is a beta command and subject to change. + Use global option ``--enable-beta-commands`` to + enable this command. + +.. program:: example list +.. code:: bash + + os example list + +Help +---- + +The command help must label the command as a beta. + +.. code-block:: python + + class ShowExample(command.ShowOne): + """Display example details + + (Caution: This is a beta command and subject to change. + Use global option --enable-beta-commands to enable + this command) + """ + +Implementation +-------------- + +The command must raise a ``CommandError`` exception if beta commands +are not enabled via ``--enable-beta-commands`` global option. + +.. code-block:: python + + def take_action(self, parsed_args): + if not self.app.options.enable_beta_commands: + msg = _('Caution: This is a beta command and subject to ' + 'change. Use global option --enable-beta-commands ' + 'to enable this command.') + raise exceptions.CommandError(msg) diff --git a/doc/source/index.rst b/doc/source/index.rst index fe12b862..08693441 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -47,6 +47,7 @@ Developer Documentation :maxdepth: 1 developing + command-beta command-options command-wrappers command-errors diff --git a/doc/source/man/openstack.rst b/doc/source/man/openstack.rst index a2ecd8db..8cd10a79 100644 --- a/doc/source/man/openstack.rst +++ b/doc/source/man/openstack.rst @@ -147,6 +147,9 @@ OPTIONS :option:`--debug` show tracebacks on errors and set verbosity to debug +:option:`--enable-beta-commands` + Enable beta commands which are subject to change + COMMANDS ======== diff --git a/openstackclient/shell.py b/openstackclient/shell.py index b96fb089..9968d73f 100644 --- a/openstackclient/shell.py +++ b/openstackclient/shell.py @@ -250,6 +250,11 @@ class OpenStackShell(app.App): action='store_true', help="Print API call timing info", ) + parser.add_argument( + '--enable-beta-commands', + action='store_true', + help="Enable beta commands which are subject to change", + ) # osprofiler HMAC key argument if osprofiler_profiler: |
