Merge "Set up /var/run/sysinv_tmp as sysinv's default temp files location"

This commit is contained in:
Zuul
2020-06-18 20:30:03 +00:00
committed by Gerrit Code Review
2 changed files with 42 additions and 0 deletions

View File

@@ -56,6 +56,7 @@ OCF_RESKEY_client_binary_default="system"
: ${OCF_RESKEY_client_binary=${OCF_RESKEY_client_binary_default}}
mydaemon="/usr/bin/${OCF_RESKEY_binary}"
TMP_DIR=/var/run/sysinv_tmp
#######################################################################
@@ -136,6 +137,22 @@ END
return ${OCF_SUCCESS}
}
sysinv_api_tmpdir () {
local rc
if [ ! -d "$TMP_DIR" ]; then
mkdir -p "$TMP_DIR"
rc=$?
if [ $rc -ne 0 ]; then
ocf_log err "Inventory Service (${OCF_RESKEY_binary}) failed to create temp dir (rc=${rc})"
return ${OCF_NOT_RUNNING}
fi
chown sysinv:sysinv "$TMP_DIR"
fi
export TMPDIR="$TMP_DIR"
return ${OCF_SUCCESS}
}
sysinv_api_validate() {
local rc
@@ -392,6 +409,10 @@ esac
# Anything except meta-data and help must pass validation
sysinv_api_validate || exit $?
# Set up tmpfiles directory to avoid temp files being
# cleaned up by systemd tmpfiles clean service.
sysinv_api_tmpdir || exit $?
if [ ${OCF_RESKEY_dbg} = "true" ] ; then
ocf_log info "${binname}:${__OCF_ACTION} action"
fi

View File

@@ -40,6 +40,7 @@ OCF_RESKEY_config_default="/etc/sysinv/sysinv.conf"
: ${OCF_RESKEY_config=${OCF_RESKEY_config_default}}
mydaemon="/usr/bin/${OCF_RESKEY_binary}"
TMP_DIR="/var/run/sysinv_tmp"
#######################################################################
@@ -111,6 +112,21 @@ END
return ${OCF_SUCCESS}
}
sysinv_conductor_tmpdir () {
local rc
if [ ! -d "$TMP_DIR" ]; then
mkdir -p "$TMP_DIR"
rc=$?
if [ $rc -ne 0 ]; then
ocf_log err "Inventory Service (${OCF_RESKEY_binary}) failed to create temp dir (rc=${rc})"
return ${OCF_NOT_RUNNING}
fi
chown sysinv:sysinv "$TMP_DIR"
fi
export TMPDIR="$TMP_DIR"
return ${OCF_SUCCESS}
}
sysinv_conductor_validate() {
local rc
@@ -396,10 +412,15 @@ esac
# Anything except meta-data and help must pass validation
sysinv_conductor_validate || exit $?
# Set up tmpfiles directory to avoid temp files being
# cleaned up by systemd tmpfiles clean service.
sysinv_conductor_tmpdir || exit $?
if [ ${OCF_RESKEY_dbg} = "true" ] ; then
ocf_log info "${binname}:${__OCF_ACTION} action"
fi
case ${__OCF_ACTION} in
start) sysinv_conductor_start