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:
arg = args
return arg
return arg.replace('-', '_')
def fetch_func_args(func):

View File

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

View File

@ -150,7 +150,7 @@ the pool configuration.
.. code-block:: bash
# 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 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``)
--dry_run Simulate an update. (Default: False)
--delete Delete Pools that are not in the input file (Defaults: False)
--dry-run This will simulate what will happen when you run this command
--delete Any Pools not listed in the config file will be deleted
.. 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
| zones that are in that Pool.
| Before running with ``--delete True`` we recommend operators run with
| ``--delete True --dry_run True`` to view the outcome.
| Before running with ``--delete`` we recommend operators run with
| ``--delete --dry-run`` to view the outcome.

View File

@ -155,8 +155,8 @@ designate-manage pool update
.. code-block:: console
usage: designate-manage pool update [-h] [--file FILE] [--delete DELETE]
[--dry_run DRY_RUN]
usage: designate-manage pool update [-h] [--file FILE] [--delete]
[--dry-run]
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
(Defaults to /etc/designate/pools.yaml)
``--delete DELETE``
``--delete``
Any Pools not listed in the config file will be deleted.
.. 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

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