diff --git a/centos_pkg_dirs b/centos_pkg_dirs index 6ded5d1d..3df065fe 100644 --- a/centos_pkg_dirs +++ b/centos_pkg_dirs @@ -2,6 +2,7 @@ cgcs-patch patch-alarm patch-scripts/EXAMPLE_0001 patch-scripts/EXAMPLE_0002 +patch-scripts/EXAMPLE_DC patch-scripts/EXAMPLE_RR patch-scripts/EXAMPLE_MTCE patch-scripts/EXAMPLE_VIM diff --git a/patch-scripts/EXAMPLE_DC/centos/EXAMPLE_DC.spec b/patch-scripts/EXAMPLE_DC/centos/EXAMPLE_DC.spec new file mode 100644 index 00000000..020783e2 --- /dev/null +++ b/patch-scripts/EXAMPLE_DC/centos/EXAMPLE_DC.spec @@ -0,0 +1,28 @@ +Name: EXAMPLE_DC +Summary: StarlingX In-Service DistCloud Patch Script Example +Version: 1.0 +Release: %{tis_patch_ver}%{?_tis_dist} +License: Apache-2.0 +Group: base +Packager: Wind River +Source0: distcloud-restart-example + +BuildArch: noarch + +%install + install -Dp -m 700 %{S:0} %{buildroot}%{_patch_scripts}/%{name} + +%description +%{summary} + +%files +%defattr(-,root,root,-) +%{_patch_scripts}/* + +%post +cp -f %{_patch_scripts}/%{name} %{_runtime_patch_scripts}/ +exit 0 + +%preun +cp -f %{_patch_scripts}/%{name} %{_runtime_patch_scripts}/ +exit 0 diff --git a/patch-scripts/EXAMPLE_DC/centos/build_srpm.data b/patch-scripts/EXAMPLE_DC/centos/build_srpm.data new file mode 100644 index 00000000..0a4d919c --- /dev/null +++ b/patch-scripts/EXAMPLE_DC/centos/build_srpm.data @@ -0,0 +1,3 @@ +COPY_LIST="scripts/*" +TIS_PATCH_VER=1 + diff --git a/patch-scripts/EXAMPLE_DC/scripts/distcloud-restart-example b/patch-scripts/EXAMPLE_DC/scripts/distcloud-restart-example new file mode 100644 index 00000000..bf9a8480 --- /dev/null +++ b/patch-scripts/EXAMPLE_DC/scripts/distcloud-restart-example @@ -0,0 +1,48 @@ +#!/bin/bash +# +# Copyright (c) 2020 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# + +# +# This script provides an example in-service distcloud restart +# + +# +# The patching subsystem provides a patch-functions bash source file +# with useful function and variable definitions. +# +. /etc/patching/patch-functions + +# +# We can now check to see what type of node we're on, if it's locked, etc, +# and act accordingly +# + +# +# Declare an overall script return code +# +declare -i GLOBAL_RC=$PATCH_STATUS_OK + + +if is_controller +then + processes_to_restart="dcmanager-manager dcmanager-api \ + dcmanager-audit dcmanager-orchestrator \ + dcorch-engine dcorch-sysinv-api-proxy dcdbsync-api \ + dcorch-patch-api-proxy dcorch-identity-api-proxy" + /usr/local/sbin/patch-restart-processes ${processes_to_restart} + if [ $? != 0 ] ; then + loginfo "patching restart failed" + loginfo "... process-restart ${processes_to_restart}" + exit ${PATCH_STATUS_FAILED} + fi +fi + +# Nothing to restart on workers or storage + +# +# Exit the script with the overall return code +# +exit $GLOBAL_RC