Fix invalid patch alarm on unlocked AIO-SX
When an AIO-SX is unlocked, the patching and unified software management systems were sharing a flag file to indicate if the system had encountered a patch failure. The flag was being incorrectly set by the unified software management system. This fixes the code that was setting of the flag, and also renames the flag in the unified software management system. Test Plan: PASS: Tox PASS: build component PASS: Boostrap/Unlock AIO-SX (no alarms) Story: 2010676 Task: 48024 Signed-off-by: Al Bailey <al.bailey@windriver.com> Change-Id: I681a641f563e851d3f4dc4d5a63b74526dd77892
This commit is contained in:
parent
e14546dbcc
commit
a58c23ca01
@ -24,8 +24,9 @@ NAME=$(basename $0)
|
||||
. /etc/platform/platform.conf
|
||||
|
||||
logfile=/var/log/software.log
|
||||
patch_failed_file=/var/run/patch_install_failed
|
||||
patched_during_init=/etc/software/.patched_during_init
|
||||
software_install_failed_file=/var/run/software_install_failed
|
||||
software_updated_during_init_file=/etc/software/.software_updated_during_init
|
||||
node_is_software_updated_rr_file=/var/run/node_is_software_updated_rr
|
||||
|
||||
# if the system has never been bootstrapped, system_mode is not set
|
||||
# treat a non bootstrapped system like it is simplex
|
||||
@ -38,26 +39,26 @@ function LOG_TO_FILE {
|
||||
echo "`date "+%FT%T.%3N"`: $NAME: $*" >> $logfile
|
||||
}
|
||||
|
||||
function check_for_rr_patch {
|
||||
if [ -f /var/run/node_is_patched_rr ]; then
|
||||
if [ ! -f ${patched_during_init} ]; then
|
||||
function check_for_rr_software_update {
|
||||
if [ -f ${node_is_software_updated_rr_file} ]; then
|
||||
if [ ! -f ${software_updated_during_init_file} ]; then
|
||||
echo
|
||||
echo "Node has been patched and requires an immediate reboot."
|
||||
echo "Node has had its software updated and requires an immediate reboot."
|
||||
echo
|
||||
LOG_TO_FILE "Node has been patched, with reboot-required flag set. Rebooting"
|
||||
touch ${patched_during_init}
|
||||
LOG_TO_FILE "Node has had its software updated, with reboot-required flag set. Rebooting"
|
||||
touch ${software_updated_during_init_file}
|
||||
/sbin/reboot
|
||||
else
|
||||
echo
|
||||
echo "Node has been patched during init a second consecutive time. Skipping reboot due to possible error"
|
||||
echo "Node has had its software updated during init a second consecutive time. Skipping reboot due to possible error"
|
||||
echo
|
||||
LOG_TO_FILE "Node has been patched during init a second consecutive time. Skipping reboot due to possible error"
|
||||
touch ${patch_failed_file}
|
||||
rm -f ${patched_during_init}
|
||||
LOG_TO_FILE "Node has had its software updated during init a second consecutive time. Skipping reboot due to possible error"
|
||||
touch ${software_install_failed_file}
|
||||
rm -f ${software_updated_during_init_file}
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
rm -f ${patched_during_init}
|
||||
rm -f ${software_updated_during_init_file}
|
||||
fi
|
||||
}
|
||||
|
||||
@ -95,7 +96,7 @@ fi
|
||||
|
||||
# For AIO-SX, abort if config is not yet applied and this is running in init
|
||||
if [ "${system_mode}" = "simplex" -a ! -f ${INITIAL_CONTROLLER_CONFIG_COMPLETE} -a "$1" = "start" ]; then
|
||||
LOG_TO_FILE "Config is not yet applied. Skipping init patching"
|
||||
LOG_TO_FILE "Config is not yet applied. Skipping init software"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@ -127,17 +128,17 @@ case "$1" in
|
||||
start)
|
||||
if [ "${system_mode}" = "simplex" ]; then
|
||||
# On a simplex CPE, we need to launch the http server first,
|
||||
# before we can do the patch installation
|
||||
# before we can do the software installation
|
||||
LOG_TO_FILE "***** Launching lighttpd *****"
|
||||
/etc/init.d/lighttpd start
|
||||
|
||||
LOG_TO_FILE "***** Starting patch operation *****"
|
||||
/usr/sbin/software-agent --install 2>>$logfile
|
||||
if [ -f ${patch_failed_file} ]; then
|
||||
LOG_TO_FILE "***** Starting software operation *****"
|
||||
/usr/bin/software-agent --install 2>>$logfile
|
||||
if [ -f ${software_install_failed_file} ]; then
|
||||
RC=1
|
||||
LOG_TO_FILE "***** Patch operation failed *****"
|
||||
LOG_TO_FILE "***** Software operation failed *****"
|
||||
fi
|
||||
LOG_TO_FILE "***** Finished patch operation *****"
|
||||
LOG_TO_FILE "***** Finished software operation *****"
|
||||
|
||||
LOG_TO_FILE "***** Shutting down lighttpd *****"
|
||||
/etc/init.d/lighttpd stop
|
||||
@ -148,28 +149,28 @@ case "$1" in
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LOG_TO_FILE "***** Starting patch operation *****"
|
||||
/usr/sbin/software-agent --install 2>>$logfile
|
||||
if [ -f ${patch_failed_file} ]; then
|
||||
LOG_TO_FILE "***** Starting software operation *****"
|
||||
/usr/bin/software-agent --install 2>>$logfile
|
||||
if [ -f ${software_install_failed_file} ]; then
|
||||
RC=1
|
||||
LOG_TO_FILE "***** Patch operation failed *****"
|
||||
LOG_TO_FILE "***** Software operation failed *****"
|
||||
fi
|
||||
LOG_TO_FILE "***** Finished patch operation *****"
|
||||
LOG_TO_FILE "***** Finished software operation *****"
|
||||
fi
|
||||
|
||||
check_for_rr_patch
|
||||
check_for_rr_software_update
|
||||
;;
|
||||
stop)
|
||||
# Nothing to do here
|
||||
;;
|
||||
restart)
|
||||
LOG_TO_FILE "***** Starting patch operation *****"
|
||||
/usr/sbin/software-agent --install 2>>$logfile
|
||||
if [ -f ${patch_failed_file} ]; then
|
||||
LOG_TO_FILE "***** Starting software operation *****"
|
||||
/usr/bin/software-agent --install 2>>$logfile
|
||||
if [ -f ${software_install_failed_file} ]; then
|
||||
RC=1
|
||||
LOG_TO_FILE "***** Patch operation failed *****"
|
||||
LOG_TO_FILE "***** Software operation failed *****"
|
||||
fi
|
||||
LOG_TO_FILE "***** Finished patch operation *****"
|
||||
LOG_TO_FILE "***** Finished software operation *****"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
|
@ -34,9 +34,9 @@ pidfile_path = "/var/run/software_agent.pid"
|
||||
agent_running_after_reboot_flag = \
|
||||
"/var/run/software_agent_running_after_reboot"
|
||||
node_is_patched_file = "/var/run/node_is_patched"
|
||||
node_is_patched_rr_file = "/var/run/node_is_patched_rr"
|
||||
node_is_software_updated_rr_file = "/var/run/node_is_software_updated_rr"
|
||||
patch_installing_file = "/var/run/patch_installing"
|
||||
patch_failed_file = "/var/run/patch_install_failed"
|
||||
patch_failed_file = "/var/run/software_install_failed"
|
||||
node_is_locked_file = "/var/run/.node_locked"
|
||||
ostree_pull_completed_deployment_pending_file = \
|
||||
"/var/run/ostree_pull_completed_deployment_pending"
|
||||
@ -258,7 +258,7 @@ class PatchMessageAgentInstallReq(messages.PatchMessage):
|
||||
resp = PatchMessageAgentInstallResp()
|
||||
|
||||
if not self.force:
|
||||
setflag(node_is_patched_rr_file)
|
||||
setflag(node_is_software_updated_rr_file)
|
||||
|
||||
if not os.path.exists(node_is_locked_file):
|
||||
if self.force:
|
||||
@ -489,11 +489,11 @@ class PatchAgent(PatchService):
|
||||
if verbose_to_stdout:
|
||||
print("This node has been patched.")
|
||||
|
||||
if os.path.exists(node_is_patched_rr_file):
|
||||
if os.path.exists(node_is_software_updated_rr_file):
|
||||
LOG.info("Reboot is required. Skipping patch-scripts")
|
||||
elif disallow_insvc_patch:
|
||||
LOG.info("Disallowing patch-scripts. Treating as reboot-required")
|
||||
setflag(node_is_patched_rr_file)
|
||||
setflag(node_is_software_updated_rr_file)
|
||||
else:
|
||||
LOG.info("Mounting the new deployment")
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user