summaryrefslogtreecommitdiff
path: root/novaclient/v2
diff options
context:
space:
mode:
authorStephen Finucane <sfinucan@redhat.com>2020-04-08 09:57:41 +0100
committerStephen Finucane <stephenfin@redhat.com>2020-04-08 17:27:33 +0100
commitea092b29880e71f0ba2d8e1eb93a9cf73edee2a2 (patch)
tree9380571295753ddc46901f75f0d98eb86d37e2e9 /novaclient/v2
parentd712c0fbc7a320f6eea4f8741f2f8d6e517a6507 (diff)
downloadpython-novaclient-ea092b29880e71f0ba2d8e1eb93a9cf73edee2a2.tar.gz
Make 'server list --config-drive' a boolean option
Instead of passing through whatever the user provides and exposing this bug in the REST API, simply make the opt a boolean one in expectation of a day where the API issues have been resolved. This also introduces machinery necessary to use more of these types of opts in the future. Change-Id: I9033540ac65ac0ee7337f16bdd002060652092ea Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Diffstat (limited to 'novaclient/v2')
-rw-r--r--novaclient/v2/servers.py9
-rw-r--r--novaclient/v2/shell.py19
2 files changed, 16 insertions, 12 deletions
diff --git a/novaclient/v2/servers.py b/novaclient/v2/servers.py
index 42184345..7768ef7a 100644
--- a/novaclient/v2/servers.py
+++ b/novaclient/v2/servers.py
@@ -893,12 +893,11 @@ class ServerManager(base.BootingManagerWithFind):
if isinstance(val, str):
val = val.encode('utf-8')
qparams[opt] = val
- # NOTE(gibi): After we fixing bug 1871409 and cleaning up the API
- # inconsistency around config_drive we can make the
- # config_drive filter a boolean filter. But until that we
- # simply pass through any value to the API even empty string.
+ # NOTE(gibi): The False value won't actually do anything until we
+ # fix bug 1871409 and clean up the API inconsistency, but we do it
+ # in preparation for that (hopefully backportable) fix
if opt == 'config_drive' and val is not None:
- qparams[opt] = val
+ qparams[opt] = str(val)
detail = ""
if detailed:
diff --git a/novaclient/v2/shell.py b/novaclient/v2/shell.py
index 8dafc164..ac6c5ea1 100644
--- a/novaclient/v2/shell.py
+++ b/novaclient/v2/shell.py
@@ -1544,16 +1544,21 @@ def _print_flavor(flavor):
default=None,
help=_('Display servers based on their keypair name (Admin only until '
'microversion 2.82).'))
-# NOTE(gibi): we can make this a real boolean filter after bug 1871409 is fixed
-# and the REST API is cleaned up regarding the values of config_drive. Unit
-# that we simply pass through any string from the user to the REST API.
@utils.arg(
'--config-drive',
- dest='config_drive',
- metavar='<config_drive>',
+ action='store_true',
+ group='config_drive',
default=None,
- help=_('Display servers based on their config_drive value (Admin only '
- 'until microversion 2.82). The value must be a boolean value.'))
+ help=_('Display servers that have a config drive attached. (Admin only '
+ 'until microversion 2.82).'))
+# NOTE(gibi): this won't actually do anything until bug 1871409 is fixed
+# and the REST API is cleaned up regarding the values of config_drive
+@utils.arg(
+ '--no-config-drive',
+ action='store_false',
+ group='config_drive',
+ help=_('Display servers that do not have a config drive attached (Admin '
+ 'only until microversion 2.82)'))
@utils.arg(
'--progress',
dest='progress',