Delete old tarball from config container on download

Delete the old tarball from the config container when the
tripleo.config.get_overcloud_config action is run. This will prevent the
new tarball from also containing the old tarball, which causes the
tarball to grow in size.

Change-Id: I85c8659e16503c40e2f9ff915106040859cc03a5
Closes-Bug: #1801416
(cherry picked from commit 388ffae7c3)
This commit is contained in:
James Slagle 2018-11-02 17:13:53 -04:00 committed by Emilien Macchi
parent 1edefd8e75
commit 34b0d7307c

View File

@ -69,6 +69,13 @@ class GetOvercloudConfig(templates.ProcessTemplatesAction):
if err.http_status != 404: if err.http_status != 404:
raise raise
# Delete downloaded tarball as it will be recreated later and we don't
# want to include the old tarball in the new tarball.
old_tarball_path = os.path.join(
self.config_dir, '%s.tar.gz' % self.container_config)
if os.path.exists(old_tarball_path):
os.unlink(old_tarball_path)
config = ooo_config.Config(heat) config = ooo_config.Config(heat)
message = ('Automatic commit by Mistral GetOvercloudConfig action.\n\n' message = ('Automatic commit by Mistral GetOvercloudConfig action.\n\n'
'User: {user}\n' 'User: {user}\n'