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: Iea6127429460ced3c6a815c267f0f543a0eaa2dc
Bug-Url: https://bugzilla.redhat.com/1091700
Bug-Url: https://bugzilla.redhat.com/1084749
Signed-off-by: Simone Tiraboschi <stira...@redhat.com>
---
A .idea/encodings.xml
A .idea/misc.xml
A .idea/modules.xml
A .idea/ovirt-reports.iml
A .idea/scopes/scope_settings.xml
A .idea/vcs.xml
M 
packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-reports/jasper/deploy.py
7 files changed, 63 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-reports refs/changes/66/27166/1

diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..e206d70
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Encoding" useUTFGuessing="true" 
native2AsciiForPropertiesFiles="false" />
+</project>
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..2533bf7
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectRootManager" version="2" project-jdk-name="Python 
3.3.2 (/usr/bin/python3.3m)" project-jdk-type="Python SDK" />
+</project>
+
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..abb3ab2
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/ovirt-reports.iml" 
filepath="$PROJECT_DIR$/.idea/ovirt-reports.iml" />
+    </modules>
+  </component>
+</project>
+
diff --git a/.idea/ovirt-reports.iml b/.idea/ovirt-reports.iml
new file mode 100644
index 0000000..a34a857
--- /dev/null
+++ b/.idea/ovirt-reports.iml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="PYTHON_MODULE" version="4">
+  <component name="NewModuleRootManager">
+    <content url="file://$MODULE_DIR$" />
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>
+
diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml
new file mode 100644
index 0000000..922003b
--- /dev/null
+++ b/.idea/scopes/scope_settings.xml
@@ -0,0 +1,5 @@
+<component name="DependencyValidationManager">
+  <state>
+    <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+  </state>
+</component>
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..c80f219
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
+  </component>
+</project>
+
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/27166
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iea6127429460ced3c6a815c267f0f543a0eaa2dc
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

Reply via email to