Add an example restart script for distributed cloud

This is the type of script that can be invoked when
applying designer patches to test distributed cloud changes.

Change-Id: I3c743bf550e28f54f5dd4b1100ef561573e88e1a
Story: 2008137
Task: 41178
Signed-off-by: albailey <Al.Bailey@windriver.com>
This commit is contained in:
albailey 2020-10-28 16:25:13 -05:00
parent 755e8b3109
commit 73c948f9e3
4 changed files with 80 additions and 0 deletions

View File

@ -2,6 +2,7 @@ cgcs-patch
patch-alarm patch-alarm
patch-scripts/EXAMPLE_0001 patch-scripts/EXAMPLE_0001
patch-scripts/EXAMPLE_0002 patch-scripts/EXAMPLE_0002
patch-scripts/EXAMPLE_DC
patch-scripts/EXAMPLE_RR patch-scripts/EXAMPLE_RR
patch-scripts/EXAMPLE_MTCE patch-scripts/EXAMPLE_MTCE
patch-scripts/EXAMPLE_VIM patch-scripts/EXAMPLE_VIM

View File

@ -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 <info@windriver.com>
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

View File

@ -0,0 +1,3 @@
COPY_LIST="scripts/*"
TIS_PATCH_VER=1

View File

@ -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