designate-manage pool update --dry-run not should pass argument

--dry-run and --delete should be switchs.
now --dry_run acts as key value pair. users do not know what is behind
--dry-run. and now whatever the value is acceptable. this is unreasonable.

Closes-bug: #1847393

Change-Id: Ia6ab93395deb95173e443f9d3ea77dd52edfcf2c
This commit is contained in:
zhouhenglc 2019-10-01 15:43:10 +08:00
parent d078b0abf3
commit d708ff588b
6 changed files with 26 additions and 12 deletions

View File

@ -89,7 +89,7 @@ def get_arg_string(args):
else: else:
arg = args arg = args
return arg return arg.replace('-', '_')
def fetch_func_args(func): def fetch_func_args(func):

View File

@ -85,10 +85,12 @@ class PoolCommands(base.Commands):
'--delete', '--delete',
help='Any Pools not listed in the config file will be deleted. ' help='Any Pools not listed in the config file will be deleted. '
' WARNING: This will delete any zones left in this pool', ' WARNING: This will delete any zones left in this pool',
action="store_true",
default=False) default=False)
@base.args( @base.args(
'--dry_run', '--dry-run',
help='This will simulate what will happen when you run this command', help='This will simulate what will happen when you run this command',
action="store_true",
default=False) default=False)
def update(self, file, delete, dry_run): def update(self, file, delete, dry_run):
self._startup() self._startup()

View File

@ -150,7 +150,7 @@ the pool configuration.
.. code-block:: bash .. code-block:: bash
# Do a dry run # Do a dry run
$ designate-manage pool update --file pools.yml --dry_run $ designate-manage pool update --file pools.yml --dry-run
$ designate-manage pool update --file pools.yml $ designate-manage pool update --file pools.yml
Designate now has two pools to work with. The next step will be to Designate now has two pools to work with. The next step will be to

View File

@ -102,16 +102,16 @@ Options:
"""""""" """"""""
--file Input file (Default: ``/etc/designate/pools.yaml``) --file Input file (Default: ``/etc/designate/pools.yaml``)
--dry_run Simulate an update. (Default: False) --dry-run This will simulate what will happen when you run this command
--delete Delete Pools that are not in the input file (Defaults: False) --delete Any Pools not listed in the config file will be deleted
.. warning:: .. warning::
| Running with ``--delete True`` can be **extremely** dangerous. | Running with ``--delete`` can be **extremely** dangerous.
| It will delete any pools that are not in the supplied YAML file, and any | It will delete any pools that are not in the supplied YAML file, and any
| zones that are in that Pool. | zones that are in that Pool.
| Before running with ``--delete True`` we recommend operators run with | Before running with ``--delete`` we recommend operators run with
| ``--delete True --dry_run True`` to view the outcome. | ``--delete --dry-run`` to view the outcome.

View File

@ -155,8 +155,8 @@ designate-manage pool update
.. code-block:: console .. code-block:: console
usage: designate-manage pool update [-h] [--file FILE] [--delete DELETE] usage: designate-manage pool update [-h] [--file FILE] [--delete]
[--dry_run DRY_RUN] [--dry-run]
Update the running pool config from a YAML file Update the running pool config from a YAML file
@ -170,11 +170,11 @@ Update the running pool config from a YAML file
The path to the file that should be used to update the pools config The path to the file that should be used to update the pools config
(Defaults to /etc/designate/pools.yaml) (Defaults to /etc/designate/pools.yaml)
``--delete DELETE`` ``--delete``
Any Pools not listed in the config file will be deleted. Any Pools not listed in the config file will be deleted.
.. warning:: This will delete any zones left in this pool .. warning:: This will delete any zones left in this pool
``--dry_run DRY_RUN`` ``--dry-run``
This will simulate what will happen when you run this command This will simulate what will happen when you run this command

View File

@ -0,0 +1,12 @@
---
upgrade:
- |
Update command ``designate-manage pool update``, change ``--dry_run`` to
``--dry-run``, and change ``--delete`` and ``--dry-run`` as switchs not
key value pair.
e.g.
.. code-block:: bash
$ designate-manage pool update --file pools.yml --delete --dry-run