Alon Bar-Lev has uploaded a new change for review.

Change subject: packaging: setup: remove: allow remove all
......................................................................

packaging: setup: remove: allow remove all

Change-Id: I4e6c8c2883db3b3a0ff996b1edc233ffc4b0f819
Signed-off-by: Alon Bar-Lev <[email protected]>
---
M packaging/setup/ovirt_engine_setup/constants.py
M packaging/setup/plugins/ovirt-engine-remove/config/ca.py
M packaging/setup/plugins/ovirt-engine-remove/core/misc.py
M packaging/setup/plugins/ovirt-engine-remove/db/clear.py
M packaging/setup/plugins/ovirt-engine-remove/files/simple.py
5 files changed, 68 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/48/18248/1

diff --git a/packaging/setup/ovirt_engine_setup/constants.py 
b/packaging/setup/ovirt_engine_setup/constants.py
index edef9dd..404dc6b 100644
--- a/packaging/setup/ovirt_engine_setup/constants.py
+++ b/packaging/setup/ovirt_engine_setup/constants.py
@@ -551,6 +551,9 @@
 
     UPGRADE_FROM_LEGACY_CONFIG = 'osetup.legacy.upgrade'
 
+    REMOVE_CUSTOMIZATION_COMMON = 'osetup.remove.customization.common'
+    REMOVE_CUSTOMIZATION_GROUPS = 'osetup.remove.customization.groups'
+
     RENAME_PKI_CONF_MISC = 'osetup.rename.pki.conf.misc'
 
 
@@ -999,6 +1002,12 @@
     def REMOVE_DATABASE(self):
         return 'OVESETUP_REMOVE/database'
 
+    @osetupattrs(
+        answerfile=True,
+    )
+    def REMOVE_ALL(self):
+        return 'OVESETUP_REMOVE/removeAll'
+
 
 @util.export
 @util.codegen
diff --git a/packaging/setup/plugins/ovirt-engine-remove/config/ca.py 
b/packaging/setup/plugins/ovirt-engine-remove/config/ca.py
index 317ba59..4b1a6d4 100644
--- a/packaging/setup/plugins/ovirt-engine-remove/config/ca.py
+++ b/packaging/setup/plugins/ovirt-engine-remove/config/ca.py
@@ -45,13 +45,18 @@
 
     @plugin.event(
         stage=plugin.Stages.STAGE_MISC,
-        condition=lambda self: 'ca_pki' in [
-            x.strip()
-            for x in self.environment[
-                osetupcons.RemoveEnv.REMOVE_GROUPS
-            ].split(',')
-            if x
-        ],
+        condition=lambda self: (
+            self.environment[
+                osetupcons.RemoveEnv.REMOVE_ALL
+            ] or
+            'ca_pki' in [
+                x.strip()
+                for x in self.environment[
+                    osetupcons.RemoveEnv.REMOVE_GROUPS
+                ].split(',')
+                if x
+            ]
+        ),
         priority=plugin.Stages.PRIORITY_HIGH,
     )
     def _misc(self):
diff --git a/packaging/setup/plugins/ovirt-engine-remove/core/misc.py 
b/packaging/setup/plugins/ovirt-engine-remove/core/misc.py
index 1f925eb..5e1be0a 100644
--- a/packaging/setup/plugins/ovirt-engine-remove/core/misc.py
+++ b/packaging/setup/plugins/ovirt-engine-remove/core/misc.py
@@ -66,6 +66,33 @@
             osetupcons.CoreEnv.REMOVE,
             None
         )
+        self.environment.setdefault(
+            osetupcons.RemoveEnv.REMOVE_ALL,
+            None
+        )
+
+    @plugin.event(
+        stage=plugin.Stages.STAGE_CUSTOMIZATION,
+        name=osetupcons.Stages.REMOVE_CUSTOMIZATION_COMMON,
+    )
+    def _customization(self):
+        if self.environment[
+            osetupcons.RemoveEnv.REMOVE_ALL
+        ] is None:
+            self.environment[
+                osetupcons.RemoveEnv.REMOVE_ALL
+            ] = dialog.queryBoolean(
+                dialog=self.dialog,
+                name='OVESETUP_REMOVE_ALL',
+                note=_(
+                    'Do you want to remove all components? '
+                    '(@VALUES@) [@DEFAULT@]: '
+                ),
+                prompt=True,
+                true=_('Yes'),
+                false=_('No'),
+                default=True,
+            )
 
     @plugin.event(
         stage=plugin.Stages.STAGE_VALIDATION,
diff --git a/packaging/setup/plugins/ovirt-engine-remove/db/clear.py 
b/packaging/setup/plugins/ovirt-engine-remove/db/clear.py
index 9fd9f11..9059b16 100644
--- a/packaging/setup/plugins/ovirt-engine-remove/db/clear.py
+++ b/packaging/setup/plugins/ovirt-engine-remove/db/clear.py
@@ -51,9 +51,19 @@
 
     @plugin.event(
         stage=plugin.Stages.STAGE_CUSTOMIZATION,
+        after=(
+            osetupcons.Stages.REMOVE_CUSTOMIZATION_COMMON,
+        ),
     )
     def _customization(self):
         if self.environment[
+            osetupcons.RemoveEnv.REMOVE_ALL
+        ]:
+            self.environment[
+                osetupcons.RemoveEnv.REMOVE_DATABASE
+            ] = True
+
+        if self.environment[
             osetupcons.RemoveEnv.REMOVE_DATABASE
         ] is None:
             self.environment[
diff --git a/packaging/setup/plugins/ovirt-engine-remove/files/simple.py 
b/packaging/setup/plugins/ovirt-engine-remove/files/simple.py
index da84e4d..ca58a42 100644
--- a/packaging/setup/plugins/ovirt-engine-remove/files/simple.py
+++ b/packaging/setup/plugins/ovirt-engine-remove/files/simple.py
@@ -113,6 +113,10 @@
 
     @plugin.event(
         stage=plugin.Stages.STAGE_CUSTOMIZATION,
+        name=osetupcons.Stages.REMOVE_CUSTOMIZATION_GROUPS,
+        after=(
+            osetupcons.Stages.REMOVE_CUSTOMIZATION_COMMON,
+        ),
     )
     def _customization(self):
         interactive = self.environment[
@@ -140,7 +144,12 @@
                     if msg == template:
                         msg = description
                     self._descriptions[group] = msg
-                    add_group = not config.getboolean(section, 'optional')
+                    add_group = (
+                        self.environment[
+                            osetupcons.RemoveEnv.REMOVE_ALL
+                        ] or
+                        not config.getboolean(section, 'optional')
+                    )
                     if (
                         not add_group and
                         interactive and


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4e6c8c2883db3b3a0ff996b1edc233ffc4b0f819
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.3
Gerrit-Owner: Alon Bar-Lev <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to