Skip to content

Commit e45b1c6

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Devref: Command Beta"
2 parents 2402dcf + 1a2e128 commit e45b1c6

5 files changed

Lines changed: 84 additions & 0 deletions

File tree

doc/source/backwards-incompatible.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ Should positional arguments for a command need to change, the OpenStackClient
1010
team attempts to make the transition as painless as possible. Look for
1111
deprecation warnings that indicate the new commands (or options) to use.
1212

13+
Commands labeled as a beta according to :doc:`command-beta` are exempt from
14+
this backwards incompatible change handling.
15+
1316
List of Backwards Incompatible Changes
1417
======================================
1518

doc/source/command-beta.rst

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
============
2+
Command Beta
3+
============
4+
5+
OpenStackClient releases do not always coincide with OpenStack
6+
releases. This creates challenges when developing new OpenStackClient
7+
commands for the current OpenStack release under development
8+
since there may not be an official release of the REST API
9+
enhancements necessary for the command. In addition, backwards
10+
compatibility may not be guaranteed until an official OpenStack release.
11+
To address these challenges, an OpenStackClient command may
12+
be labeled as a beta command according to the guidelines
13+
below. Such commands may introduce backwards incompatible
14+
changes and may use REST API enhancements not yet released.
15+
16+
See the examples below on how to label a command as a beta
17+
by updating the command documentation, help and implementation.
18+
19+
The initial release note must label the new command as a beta.
20+
No further release notes are required until the command
21+
is no longer a beta. At which time, the command beta label
22+
or the command itself must be removed and a new release note
23+
must be provided.
24+
25+
Documentation
26+
-------------
27+
28+
The command documentation must label the command as a beta.
29+
30+
example list
31+
~~~~~~~~~~~~
32+
33+
List examples
34+
35+
.. caution:: This is a beta command and subject to change.
36+
Use global option ``--enable-beta-commands`` to
37+
enable this command.
38+
39+
.. program:: example list
40+
.. code:: bash
41+
42+
os example list
43+
44+
Help
45+
----
46+
47+
The command help must label the command as a beta.
48+
49+
.. code-block:: python
50+
51+
class ShowExample(command.ShowOne):
52+
"""Display example details
53+
54+
(Caution: This is a beta command and subject to change.
55+
Use global option --enable-beta-commands to enable
56+
this command)
57+
"""
58+
59+
Implementation
60+
--------------
61+
62+
The command must raise a ``CommandError`` exception if beta commands
63+
are not enabled via ``--enable-beta-commands`` global option.
64+
65+
.. code-block:: python
66+
67+
def take_action(self, parsed_args):
68+
if not self.app.options.enable_beta_commands:
69+
msg = _('Caution: This is a beta command and subject to '
70+
'change. Use global option --enable-beta-commands '
71+
'to enable this command.')
72+
raise exceptions.CommandError(msg)

doc/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Developer Documentation
4747
:maxdepth: 1
4848

4949
developing
50+
command-beta
5051
command-options
5152
command-wrappers
5253
command-errors

doc/source/man/openstack.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ OPTIONS
147147
:option:`--debug`
148148
show tracebacks on errors and set verbosity to debug
149149

150+
:option:`--enable-beta-commands`
151+
Enable beta commands which are subject to change
152+
150153
COMMANDS
151154
========
152155

openstackclient/shell.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,11 @@ def build_option_parser(self, description, version):
250250
action='store_true',
251251
help="Print API call timing info",
252252
)
253+
parser.add_argument(
254+
'--enable-beta-commands',
255+
action='store_true',
256+
help="Enable beta commands which are subject to change",
257+
)
253258

254259
# osprofiler HMAC key argument
255260
if osprofiler_profiler:

0 commit comments

Comments
 (0)