Merge "Fix image import --disallow-failure flag"
This commit is contained in:
commit
1763c11963
openstackclient
@ -1689,7 +1689,8 @@ class ImportImage(command.ShowOne):
|
|||||||
"'copy-image' import method)"
|
"'copy-image' import method)"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
allow_failure_group = parser.add_mutually_exclusive_group()
|
||||||
|
allow_failure_group.add_argument(
|
||||||
'--allow-failure',
|
'--allow-failure',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
dest='allow_failure',
|
dest='allow_failure',
|
||||||
@ -1700,9 +1701,9 @@ class ImportImage(command.ShowOne):
|
|||||||
'Only usable with --stores or --all-stores'
|
'Only usable with --stores or --all-stores'
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
allow_failure_group.add_argument(
|
||||||
'--disallow-failure',
|
'--disallow-failure',
|
||||||
action='store_true',
|
action='store_false',
|
||||||
dest='allow_failure',
|
dest='allow_failure',
|
||||||
default=True,
|
default=True,
|
||||||
help=_(
|
help=_(
|
||||||
|
@ -2092,6 +2092,38 @@ class TestImageImport(TestImage):
|
|||||||
all_stores_must_succeed=False,
|
all_stores_must_succeed=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_import_image__copy_image_disallow_failure(self):
|
||||||
|
self.image.status = 'active'
|
||||||
|
arglist = [
|
||||||
|
self.image.name,
|
||||||
|
'--method',
|
||||||
|
'copy-image',
|
||||||
|
'--store',
|
||||||
|
'fast',
|
||||||
|
'--disallow-failure',
|
||||||
|
]
|
||||||
|
verifylist = [
|
||||||
|
('image', self.image.name),
|
||||||
|
('import_method', 'copy-image'),
|
||||||
|
('stores', ['fast']),
|
||||||
|
('allow_failure', False),
|
||||||
|
]
|
||||||
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
|
self.cmd.take_action(parsed_args)
|
||||||
|
|
||||||
|
self.image_client.import_image.assert_called_once_with(
|
||||||
|
self.image,
|
||||||
|
method='copy-image',
|
||||||
|
uri=None,
|
||||||
|
remote_region=None,
|
||||||
|
remote_image_id=None,
|
||||||
|
remote_service_interface=None,
|
||||||
|
stores=['fast'],
|
||||||
|
all_stores=None,
|
||||||
|
all_stores_must_succeed=True,
|
||||||
|
)
|
||||||
|
|
||||||
def test_import_image__glance_download(self):
|
def test_import_image__glance_download(self):
|
||||||
arglist = [
|
arglist = [
|
||||||
self.image.name,
|
self.image.name,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user