Merge "Validate for empty file for stack-adopt"
This commit is contained in:
@@ -1844,6 +1844,16 @@ class ShellTestUserPass(ShellBase):
|
|||||||
self.shell_error('stack-adopt teststack ', failed_msg,
|
self.shell_error('stack-adopt teststack ', failed_msg,
|
||||||
exception=exc.CommandError)
|
exception=exc.CommandError)
|
||||||
|
|
||||||
|
def test_stack_adopt_empty_data_file(self):
|
||||||
|
failed_msg = 'Invalid adopt-file, no data!'
|
||||||
|
self.register_keystone_auth_fixture()
|
||||||
|
self.m.ReplayAll()
|
||||||
|
with tempfile.NamedTemporaryFile() as file_obj:
|
||||||
|
self.shell_error(
|
||||||
|
'stack-adopt teststack '
|
||||||
|
'--adopt-file=%s ' % (file_obj.name),
|
||||||
|
failed_msg, exception=exc.CommandError)
|
||||||
|
|
||||||
def test_stack_update_enable_rollback(self):
|
def test_stack_update_enable_rollback(self):
|
||||||
self.register_keystone_auth_fixture()
|
self.register_keystone_auth_fixture()
|
||||||
template_file = os.path.join(TEST_VAR_DIR, 'minimal.template')
|
template_file = os.path.join(TEST_VAR_DIR, 'minimal.template')
|
||||||
|
|||||||
@@ -177,6 +177,9 @@ def do_stack_adopt(hc, args):
|
|||||||
adopt_url = utils.normalise_file_path_to_url(args.adopt_file)
|
adopt_url = utils.normalise_file_path_to_url(args.adopt_file)
|
||||||
adopt_data = request.urlopen(adopt_url).read()
|
adopt_data = request.urlopen(adopt_url).read()
|
||||||
|
|
||||||
|
if not len(adopt_data):
|
||||||
|
raise exc.CommandError('Invalid adopt-file, no data!')
|
||||||
|
|
||||||
if args.create_timeout:
|
if args.create_timeout:
|
||||||
logger.warning(_LW('%(arg1)s is deprecated, '
|
logger.warning(_LW('%(arg1)s is deprecated, '
|
||||||
'please use %(arg2)s instead'),
|
'please use %(arg2)s instead'),
|
||||||
|
|||||||
Reference in New Issue
Block a user