mirror of
https://github.com/openshift/installer.git
synced 2026-02-05 15:47:14 +01:00
We haven't set $WORKSPACE since 1dea5c84 (tests: Remove unused
smoke.sh + tfvars file, 2017-10-04, coreos/tectonic-installer#2036),
so there's no longer a need for the --workspace-dir options. Users
who care where the scratch files live can set $TMPDIR:
$ man 7 environ | grep TMPDIR | sed 's/ */ /g' | cut -b -67
* TMPDIR influences the path prefix of names created by tempnam(3)
I'm still calling readlink on the mktemp output in case $TMPDIR (or
/tmp, if $TMPDIR is unset) is a symlink.
I'm also fixing --config-file, --exclude-file, and --tag-file.
Previously we were using:
CONFIG_FILE="/tmp/config/$(basename "$config_file")"
and similar. But inside the container, /tmp/config is coming from the
$tmp_dir volume mount. And when --config-file was set, we weren't
writing the referenced content into $tmp_dir. Now we always write the
content into $tmp_dir, regardless of whether the content is
user-supplied or the script's default.
Also avoid some parallel-call races by avoiding a shared /tmp/config
(or ${workspace}/config). With the old approach, the trap rm call for
one invocation could blow away a /tmp/config used by another
invocation. With this commit, we use mktemp to give a secure, unique
$tmp_dir. And once we have that, we can hard-code the paths to the
config, tag, and exclude files inside $tmp_dir.