Skip to content

Commit 3da3a2b

Browse files
Update style of temp dir cleanup function
The function was in the middle of other internal functions, so it was moved for readability. Indentation was changed to tabs and made to be consistent. Signed-off-by: Steve Kuznetsov <[email protected]>
1 parent 8b6ea7f commit 3da3a2b

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

hack/lib/cleanup.sh

Lines changed: 26 additions & 26 deletions
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

0 commit comments

Comments
 (0)