[stable-only] Use folder with plan name for config download export
To be consistent with auto config-download and overcloud export create subfloder with plan/stack name. Change-Id: I08b447379ae6e267f8dff11e6e703a991918683c Closes-Bug: #1884246
This commit is contained in:
parent
fca6d30b59
commit
46c9aa552f
|
@ -50,6 +50,7 @@ class TestOvercloudConfig(utils.TestCommand):
|
|||
mock_open.assert_called()
|
||||
mock_request.urlopen.assert_called()
|
||||
|
||||
@mock.patch('os.path.exists')
|
||||
@mock.patch('tripleoclient.v1.overcloud_config.processutils.execute')
|
||||
@mock.patch('tripleoclient.v1.overcloud_config.open')
|
||||
@mock.patch('tripleoclient.v1.overcloud_config.request')
|
||||
|
@ -57,7 +58,7 @@ class TestOvercloudConfig(utils.TestCommand):
|
|||
@mock.patch('tripleoclient.workflows.deployment.config_download_export')
|
||||
def test_overcloud_download_config_no_preserve(
|
||||
self, mock_config, mock_rmtree, mock_request,
|
||||
mock_open, mock_execute):
|
||||
mock_open, mock_execute, mock_exists):
|
||||
arglist = ['--name', 'overcloud', '--config-dir', '/tmp',
|
||||
'--no-preserve-config']
|
||||
verifylist = [
|
||||
|
@ -66,6 +67,13 @@ class TestOvercloudConfig(utils.TestCommand):
|
|||
('preserve_config_dir', False)
|
||||
]
|
||||
|
||||
def side_effect(arg):
|
||||
if arg == '/tmp/overcloud':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
mock_exists.side_effect = side_effect
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
self.cmd.take_action(parsed_args)
|
||||
mock_config.assert_called_once_with(
|
||||
|
|
|
@ -88,9 +88,11 @@ class DownloadConfig(command.Command):
|
|||
|
||||
name = parsed_args.name
|
||||
config_dir = parsed_args.config_dir
|
||||
|
||||
work_dir = os.path.join(config_dir, name)
|
||||
config_type = parsed_args.config_type
|
||||
preserve_config_dir = parsed_args.preserve_config_dir
|
||||
self.create_config_dir(config_dir, preserve_config_dir)
|
||||
self.create_config_dir(work_dir, preserve_config_dir)
|
||||
|
||||
# Get config
|
||||
print("Starting config-download export...")
|
||||
|
@ -105,14 +107,14 @@ class DownloadConfig(command.Command):
|
|||
tarball_contents = f.read()
|
||||
f.close()
|
||||
tarball_name = "%s-config.tar.gz" % name
|
||||
tarball_path = os.path.join(config_dir, tarball_name)
|
||||
tarball_path = os.path.join(work_dir, tarball_name)
|
||||
|
||||
with open(tarball_path, 'wb') as f:
|
||||
f.write(tarball_contents)
|
||||
|
||||
print("Extracting config-download...")
|
||||
cmd = ['/usr/bin/tar', '-C', config_dir, '-xf', tarball_path]
|
||||
cmd = ['/usr/bin/tar', '-C', work_dir, '-xf', tarball_path]
|
||||
processutils.execute(*cmd)
|
||||
|
||||
print("The TripleO configuration has been successfully generated "
|
||||
"into: {0}".format(config_dir))
|
||||
"into: {0}".format(work_dir))
|
||||
|
|
Loading…
Reference in New Issue