Fix deploy host for in-service patch

'software deploy host <in-service-patch-release>' should NOT fail if
there is no restart-script (post-deploy script).
If the rsync does not find the scripts, does not raise an exception.

Test-plan:
PASS: software deploy host <in-service-patch-release> successful

Closes-bug: 2058393

Change-Id: I1b8cac9e0401c3f64c7334139c62bf272e9aeb56
Signed-off-by: Lindley Werner <Lindley.Vieira@windriver.com>
This commit is contained in:
Lindley Werner 2024-03-04 16:08:25 -03:00
parent 047555f6ff
commit 831d3d3e93
1 changed files with 19 additions and 10 deletions

View File

@ -1,5 +1,5 @@
""" """
Copyright (c) 2023 Wind River Systems, Inc. Copyright (c) 2024 Wind River Systems, Inc.
SPDX-License-Identifier: Apache-2.0 SPDX-License-Identifier: Apache-2.0
@ -71,15 +71,24 @@ def clearflag(fname):
def pull_restart_scripts_from_controller(): def pull_restart_scripts_from_controller():
# If the rsync fails, it raises an exception to # If the rsync fails, it raises an exception to
# the caller "handle_install()" and fails the # the caller "handle_install()" and fails the
# host-install request for this host # host-install request for this host.
output = subprocess.check_output(["rsync", # The restart_scripts are optional, so if the files
"-acv", # are not present, it should not raise any exception
"--delete", try:
"--exclude", "tmp", output = subprocess.check_output(["rsync",
"rsync://controller/repo/software-scripts/", "-acv",
"%s/" % insvc_software_scripts], "--delete",
stderr=subprocess.STDOUT) "--exclude", "tmp",
LOG.info("Synced restart scripts from controller: %s", output) "rsync://controller/repo/software-scripts/",
"%s/" % insvc_software_scripts],
stderr=subprocess.STDOUT)
LOG.info("Synced restart scripts from controller: %s", output)
except subprocess.CalledProcessError as e:
if "No such file or directory" in e.output.decode("utf-8"):
LOG.info("No restart scripts contained in the release")
else:
LOG.exception("Failed to sync restart scripts from controller")
raise
def check_install_uuid(): def check_install_uuid():