Do not deploy if pre-install fails
If pre-install script execution fails the software agent still tries to create the deploy and run the post-install script. This commit fixes it by returning and setting the state to deploy-host-failed. Test-plan SX and DX: PASS: deploy 24.09.1-preinstall-failure.patch, abort after the error and rollback. Story: 2010676 Task: 51160 Change-Id: If409ec3065172241170279023bb08b7e13366ffe Signed-off-by: Lindley Vieira <lindley.vieira@windriver.com>
This commit is contained in:
parent
d180e97d98
commit
94cc0843ab
@ -689,6 +689,12 @@ class PatchAgent(PatchService):
|
||||
# "/sysroot/ostree/repo/config" file
|
||||
ostree_utils.pull_ostree_from_remote(remote=remote)
|
||||
setflag(ostree_pull_completed_deployment_pending_file)
|
||||
|
||||
# Create a new deployment once the changes are pulled
|
||||
ostree_utils.create_deployment(ref=ref)
|
||||
|
||||
changed = True
|
||||
clearflag(ostree_pull_completed_deployment_pending_file)
|
||||
except OSTreeCommandFail:
|
||||
LOG.exception("Failed to pull changes and create deployment"
|
||||
"during host-install.")
|
||||
@ -698,18 +704,6 @@ class PatchAgent(PatchService):
|
||||
LOG.error("Command output: %s", e.output)
|
||||
success = False
|
||||
|
||||
try:
|
||||
# Create a new deployment once the changes are pulled
|
||||
ostree_utils.create_deployment(ref=ref)
|
||||
|
||||
changed = True
|
||||
clearflag(ostree_pull_completed_deployment_pending_file)
|
||||
|
||||
except OSTreeCommandFail:
|
||||
LOG.exception("Failed to pull changes and create deployment"
|
||||
"during host-install.")
|
||||
success = False
|
||||
|
||||
if changed:
|
||||
# Update the node_is_patched flag
|
||||
setflag(node_is_patched_file)
|
||||
|
Loading…
Reference in New Issue
Block a user