Allow users to specify TMPDIR in containers.conf

Currently we hard code TMPDIR environment variable to /var/tmp
if it is not set in the Environment. This causes TMPDIR environment
variable to be ignored if set in containers.conf.

This change now uses the host environment TMPDIR, followed by
containers.conf and then hard codes TMPDIR, if it was not set.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2020-12-15 06:35:41 -05:00
parent 999d40d2c7
commit d5e05a4b92
2 changed files with 4 additions and 5 deletions

View File

@ -31,11 +31,6 @@ func main() {
return
}
// Hard code TMPDIR functions to use /var/tmp, if user did not override
if _, ok := os.LookupEnv("TMPDIR"); !ok {
os.Setenv("TMPDIR", "/var/tmp")
}
rootCmd = parseCommands()
Execute()

View File

@ -178,6 +178,10 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error {
return err
}
}
// Hard code TMPDIR functions to use /var/tmp, if user did not override
if _, ok := os.LookupEnv("TMPDIR"); !ok {
os.Setenv("TMPDIR", "/var/tmp")
}
if !registry.IsRemote() {
if cmd.Flag("cpu-profile").Changed {