diff options
| author | Stephen Finucane <sfinucan@redhat.com> | 2021-03-11 15:53:39 +0000 |
|---|---|---|
| committer | Stephen Finucane <sfinucan@redhat.com> | 2021-03-11 15:56:59 +0000 |
| commit | 2ccf7727a6c06214956b7067e7932015bcdfb5a5 (patch) | |
| tree | 383a1de5029f624833b9d94eeff5442922c990f5 /openstackclient/compute | |
| parent | ae1f8f888a9a143dc93e21d73408fbbc74307907 (diff) | |
| download | python-openstackclient-2ccf7727a6c06214956b7067e7932015bcdfb5a5.tar.gz | |
compute: Remove 'file://' prefix from '--block-device'
There are a couple of other (networking-related) options which accept
paths, none of which insist on a URI-style path. Let's just drop this
bit of complexity before we release the feature.
Change-Id: Ia7f781d82f3f4695b49b55a39abbb6e582cd879c
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Diffstat (limited to 'openstackclient/compute')
| -rw-r--r-- | openstackclient/compute/v2/server.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py index cd6e2c91..b81d2a18 100644 --- a/openstackclient/compute/v2/server.py +++ b/openstackclient/compute/v2/server.py @@ -21,7 +21,6 @@ import io import json import logging import os -import urllib.parse from cliff import columns as cliff_columns import iso8601 @@ -774,9 +773,8 @@ class BDMAction(parseractions.MultiKeyValueAction): if getattr(namespace, self.dest, None) is None: setattr(namespace, self.dest, []) - if values.startswith('file://'): - path = urllib.parse.urlparse(values).path - with open(path) as fh: + if os.path.exists(values): + with open(values) as fh: data = json.load(fh) # Validate the keys - other validation is left to later @@ -898,10 +896,9 @@ class CreateServer(command.ShowOne): default=[], help=_( 'Create a block device on the server.\n' - 'Either a URI-style path (\'file:\\\\{path}\') to a JSON file ' - 'or a CSV-serialized string describing the block device ' - 'mapping.\n' - 'The following keys are accepted:\n' + 'Either a path to a JSON file or a CSV-serialized string ' + 'describing the block device mapping.\n' + 'The following keys are accepted for both:\n' 'uuid=<uuid>: UUID of the volume, snapshot or ID ' '(required if using source image, snapshot or volume),\n' 'source_type=<source_type>: source type ' |
