Hello Yedidyah Bar David,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/18614

to review the following change.

Change subject: packaging: setup: Prevent cleanup without setup
......................................................................

packaging: setup: Prevent cleanup without setup

Change-Id: Ib1dc356976ada9029895b237bd6a0b4771dea64b
Signed-off-by: Yedidyah Bar David <d...@redhat.com>
---
M packaging/setup/plugins/ovirt-engine-remove/core/misc.py
1 file changed, 24 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/14/18614/1

diff --git a/packaging/setup/plugins/ovirt-engine-remove/core/misc.py 
b/packaging/setup/plugins/ovirt-engine-remove/core/misc.py
index d9a8935..96a6a2f 100644
--- a/packaging/setup/plugins/ovirt-engine-remove/core/misc.py
+++ b/packaging/setup/plugins/ovirt-engine-remove/core/misc.py
@@ -19,6 +19,7 @@
 """Engine plugin."""
 
 
+import os
 import gettext
 _ = lambda m: gettext.dgettext(message=m, domain='ovirt-engine-setup')
 
@@ -76,6 +77,29 @@
     )
     def _setup(self):
         self.environment[osetupcons.CoreEnv.GENERATE_POSTINSTALL] = False
+        if not os.path.exists(
+            osetupcons.FileLocations.OVIRT_SETUP_POST_INSTALL_CONFIG
+        ):
+            self.logger.error(_('Could not detect a completed product setup'))
+            self.dialog.note(
+                text=_(
+                    'Please use the cleanup utility only after a setup '
+                    'or after an upgrade from an older installation.'
+                )
+            )
+            if os.path.exists(
+                osetupcons.FileLocations.OVIRT_ENGINE_PKI_ENGINE_CA_CERT
+            ):
+                self.dialog.note(
+                    text=_(
+                        'If you want to cleanup after setup of a previous '
+                        'version, you should use the setup package of that '
+                        'version.'
+                    )
+                )
+            raise RuntimeError(
+                _('Could not detect product setup')
+            )
 
     @plugin.event(
         stage=plugin.Stages.STAGE_CUSTOMIZATION,


-- 
To view, visit http://gerrit.ovirt.org/18614
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib1dc356976ada9029895b237bd6a0b4771dea64b
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.3
Gerrit-Owner: Alon Bar-Lev <alo...@redhat.com>
Gerrit-Reviewer: Yedidyah Bar David <d...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to