From 048401228dd9f1716eb1fc060e84e385ec2def4f Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Fri, 11 Sep 2020 13:10:10 -0600 Subject: [PATCH] Add --temp-dir to overcloud image build By default, DIB puts the temp folders it uses in /tmp. In newer versions, this can cause images to go missing because systemd will cleanup tmp (see tmpfiles.d) which may cause files and directories in the image to missing. This change adds a --temp-dir option to the cli which by default will configure TMPDIR to be the current working directory if not specified. Change-Id: Ib5f82a175266675d9639416dd664604bee370a1d Closes-Bug: #1879766 (cherry picked from commit 4c7df58d9b444c29f8d990a7032b8eb31cec46af) --- tripleoclient/v1/overcloud_image.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tripleoclient/v1/overcloud_image.py b/tripleoclient/v1/overcloud_image.py index 3a0b92e7e..353745ee5 100644 --- a/tripleoclient/v1/overcloud_image.py +++ b/tripleoclient/v1/overcloud_image.py @@ -82,6 +82,13 @@ class BuildOvercloudImage(command.Command): help=_("Output directory for images. Defaults to $TRIPLEO_ROOT," "or current directory if unset."), ) + parser.add_argument( + "--temp-dir", + dest="temp_dir", + default=os.environ.get('TMPDIR', os.getcwd()), + help=_("Temporary directory to use when building the images. " + "Defaults to $TMPDIR or current directory if unset."), + ) return parser def take_action(self, parsed_args): @@ -90,6 +97,7 @@ class BuildOvercloudImage(command.Command): if not parsed_args.config_files: parsed_args.config_files = [os.path.join(self.IMAGE_YAML_PATH, f) for f in self.DEFAULT_YAML] + os.environ.update({'TMPDIR': parsed_args.temp_dir}) manager = build.ImageBuildManager( parsed_args.config_files, output_directory=parsed_args.output_directory,