Skip to content

Commit e255896

Browse files
author
Kyle MacLeod
committed
Set cert-mon temp dir location to /var/run/cert-mon_tmp
Redirect the k8s python client's use of /tmp to /var/run/cert-mon_tmp via setting TMPDIR This is a known issue of kubernetes python client: kubernetes-client/python#765 The fix is the same as for https://bugs.launchpad.net/starlingx/+bug/1883599 See commit message there for more details. Related-Bug: 1883599 Closes-Bug: 1936435 Signed-off-by: Kyle MacLeod <[email protected]> Change-Id: I0e163bd1b4d5a19f07267dd4cd14bad1b8cb20bb
1 parent ea64d0a commit e255896

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

sysinv/cert-mon/files/cert-mon

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ OCF_RESKEY_config_default="/etc/sysinv/cert-mon.conf"
3232
: ${OCF_RESKEY_client_binary=${OCF_RESKEY_client_binary_default}}
3333

3434
mydaemon="/usr/bin/${OCF_RESKEY_binary}"
35+
TMP_DIR=/var/run/cert-mon_tmp
3536

3637
#######################################################################
3738

@@ -110,6 +111,22 @@ END
110111
return ${OCF_SUCCESS}
111112
}
112113

114+
cert_mon_tmpdir() {
115+
local rc
116+
117+
if [ ! -d "$TMP_DIR" ]; then
118+
mkdir -p "$TMP_DIR"
119+
rc=$?
120+
if [ $rc -ne 0 ]; then
121+
ocf_log err "Certificate Monitor Service (${OCF_RESKEY_binary}) failed to create temp dir (rc=${rc})"
122+
return "${OCF_ERR_GENERIC}"
123+
fi
124+
chown "${OCF_RESKEY_user_default}:${OCF_RESKEY_user_default}" "$TMP_DIR"
125+
fi
126+
export TMPDIR="$TMP_DIR"
127+
return "${OCF_SUCCESS}"
128+
}
129+
113130
cert_mon_validate() {
114131

115132
local rc
@@ -329,6 +346,10 @@ esac
329346
# Anything except meta-data and help must pass validation
330347
cert_mon_validate || exit $?
331348

349+
# Set up tmpfiles directory to avoid temp files being
350+
# cleaned up by systemd tmpfiles clean service.
351+
cert_mon_tmpdir || exit $?
352+
332353
if [ ${OCF_RESKEY_dbg} = "true" ] ; then
333354
ocf_log info "${binname}:${__OCF_ACTION} action"
334355
fi

0 commit comments

Comments
 (0)