Skip to content

Commit c92000c

Browse files
author
OpenShift Bot
authored
Merge pull request #13623 from stevekuznetsov/skuznets/cleanup
Merged by openshift-bot
2 parents 7aa86c8 + d57c6a4 commit c92000c

File tree

2 files changed

+27
-28
lines changed

2 files changed

+27
-28
lines changed

hack/lib/cleanup.sh

+26-26
Original file line numberDiff line numberDiff line change
@@ -76,31 +76,6 @@ function os::cleanup::dump_container_logs() {
7676
}
7777
readonly -f os::cleanup::dump_container_logs
7878

79-
# os::cleanup::tmpdir performs cleanup of temp directories as a precondition for running a test. It tries to
80-
# clean up mounts in the temp directories.
81-
#
82-
# Globals:
83-
# - BASETMPDIR
84-
# - USE_SUDO
85-
# Returns:
86-
# None
87-
function os::cleanup::tmpdir() {
88-
# ensure that the directories are clean
89-
if os::util::find::system_binary "findmnt" &>/dev/null; then
90-
for target in $( ${USE_SUDO:+sudo} findmnt --output TARGET --list ); do
91-
if [[ "${target}" == "${BASETMPDIR}"* ]]; then
92-
${USE_SUDO:+sudo} umount "${target}"
93-
fi
94-
done
95-
fi
96-
97-
# delete any sub directory underneath BASETMPDIR
98-
for directory in $( find "${BASETMPDIR}" -d 2 ); do
99-
${USE_SUDO:+sudo} rm -rf "${directory}"
100-
done
101-
}
102-
readonly -f os::cleanup::tmpdir
103-
10479
# os::cleanup::internal::list_k8s_containers returns a space-delimited list of
10580
# docker containers that belonged to k8s.
10681
#
@@ -122,4 +97,29 @@ function os::cleanup::internal::list_k8s_containers() {
12297

12398
echo "${ids[*]:+"${ids[*]}"}"
12499
}
125-
readonly -f os::cleanup::internal::list_k8s_containers
100+
readonly -f os::cleanup::internal::list_k8s_containers
101+
102+
# os::cleanup::tmpdir performs cleanup of temp directories as a precondition for running a test. It tries to
103+
# clean up mounts in the temp directories.
104+
#
105+
# Globals:
106+
# - BASETMPDIR
107+
# - USE_SUDO
108+
# Returns:
109+
# None
110+
function os::cleanup::tmpdir() {
111+
# ensure that the directories are clean
112+
if os::util::find::system_binary "findmnt" &>/dev/null; then
113+
for target in $( ${USE_SUDO:+sudo} findmnt --output TARGET --list ); do
114+
if [[ "${target}" == "${BASETMPDIR}"* ]]; then
115+
${USE_SUDO:+sudo} umount "${target}"
116+
fi
117+
done
118+
fi
119+
120+
# delete any sub directory underneath BASETMPDIR
121+
for directory in $( find "${BASETMPDIR}" -d 2 ); do
122+
${USE_SUDO:+sudo} rm -rf "${directory}"
123+
done
124+
}
125+
readonly -f os::cleanup::tmpdir

hack/lib/cmd.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@ readonly -f os::cmd::try_until_text
157157

158158
# In order to harvest stderr and stdout at the same time into different buckets, we need to stick them into files
159159
# in an intermediate step
160-
BASETMPDIR="${TMPDIR:-"/tmp"}/openshift"
161-
os_cmd_internal_tmpdir="${BASETMPDIR}/test-cmd"
160+
os_cmd_internal_tmpdir="${TMPDIR:-"/tmp"}/openshift"
162161
os_cmd_internal_tmpout="${os_cmd_internal_tmpdir}/tmp_stdout.log"
163162
os_cmd_internal_tmperr="${os_cmd_internal_tmpdir}/tmp_stderr.log"
164163

0 commit comments

Comments
 (0)