|
| 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) |
0 commit comments