Simone Tiraboschi has uploaded a new change for review. Change subject: packaging: setup: Removing build-conf files on failure ......................................................................
packaging: setup: Removing build-conf files on failure If setup fails it should cleanup the partially deployed files in order to allow a future clean setup. If those files were alredy there it restores the backup copy of the older ones, otherwise it simply removes the new files. Change-Id: I2507ea0c6ecd6d0a69f56d0693fcafd21f58992f Bug-Url: https://bugzilla.redhat.com/1091700 Bug-Url: https://bugzilla.redhat.com/1084749 Signed-off-by: Simone Tiraboschi <stira...@redhat.com> --- M packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-reports/jasper/deploy.py 1 file changed, 23 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-reports refs/changes/67/27167/1 diff --git a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-reports/jasper/deploy.py b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-reports/jasper/deploy.py index 056069c..d9eb2ea 100644 --- a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-reports/jasper/deploy.py +++ b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-reports/jasper/deploy.py @@ -56,6 +56,7 @@ def __init__(self, parent): self._parent = parent self._restore = [] + self._drop_aborting = [] self._backup = None self._dbovirtutils = database.OvirtUtils( @@ -81,6 +82,8 @@ dst = '%s.%s' % (src, suffix) self._restore.append(dict(src=src, dst=dst)) os.rename(src, dst) + else: + self._drop_aborting.append(src) if not self._parent.environment[ oreportscons.DBEnv.NEW_DATABASE @@ -152,6 +155,26 @@ error=e, ) ) + for entry in self._drop_aborting: + try: + if os.path.exists(entry): + shutil.rmtree(entry) + except Exception as e: + self._parent.logger.debug( + 'Exception during removing %s', + entry, + exc_info=True, + ) + self._parent.logger.error( + _( + "Remove of file '{entry}' failed during rollback: " + "{error}" + ).format( + entry=entry, + error=e, + ) + ) + def commit(self): for entry in self._restore: -- To view, visit http://gerrit.ovirt.org/27167 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2507ea0c6ecd6d0a69f56d0693fcafd21f58992f Gerrit-PatchSet: 1 Gerrit-Project: ovirt-reports Gerrit-Branch: master Gerrit-Owner: Simone Tiraboschi <stira...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches