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

Change subject: packaging: setup: do not override answer file when applying 
post install removal
......................................................................

packaging: setup: do not override answer file when applying post install removal

OVESETUP_SYSTEM/nfsConfigEnabled should be removed from post install
file.

we need to find a way to do that in generic way, but for time being we
provide local solution.

the last method we have done to set None at boot stage is good, however
the answer file is configuration just like the post install file, we
have no way to distinguish.

without setting the value at boot stage, the issue would have been
resolved at the 2nd setup run, but we want it to be solved at the next
setup run.

to mark this legacy state a new postinstall variable was added, if it is
None then we know that we have legacy post-install and we do not look
into the content of OVESETUP_SYSTEM/nfsConfigEnabled.

Bug-Url: https://bugzilla.redhat.com/1056777
Change-Id: I907380d1d39c33ffcc43fdd49192a5096a000539
Signed-off-by: Alon Bar-Lev <[email protected]>
---
M packaging/setup/ovirt_engine_setup/constants.py
M packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/system/nfs.py
2 files changed, 34 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/63/26463/1

diff --git a/packaging/setup/ovirt_engine_setup/constants.py 
b/packaging/setup/ovirt_engine_setup/constants.py
index 4949b78..321b83c 100644
--- a/packaging/setup/ovirt_engine_setup/constants.py
+++ b/packaging/setup/ovirt_engine_setup/constants.py
@@ -806,6 +806,12 @@
     def NFS_CONFIG_ENABLED(self):
         return 'OVESETUP_SYSTEM/nfsConfigEnabled'
 
+    @osetupattrs(
+        postinstallfile=True,
+    )
+    def NFS_CONFIG_ENABLED_LEGACY_IN_POSTINSTALL(self):
+        return 'OVESETUP_SYSTEM/nfsConfigEnabled_legacyInPostInstall'
+
     HOSTILE_SERVICES = 'OVESETUP_SYSTEM/hostileServices'
 
 
diff --git 
a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/system/nfs.py 
b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/system/nfs.py
index e2dba6a..da39971 100644
--- a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/system/nfs.py
+++ b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/system/nfs.py
@@ -60,23 +60,29 @@
         )[0]
 
     @plugin.event(
-        stage=plugin.Stages.STAGE_BOOT,
-    )
-    def _boot(self):
-        # Override existing post installs
-        self.environment.setdefault(
-            osetupcons.SystemEnv.NFS_CONFIG_ENABLED,
-            None
-        )
-
-    @plugin.event(
         stage=plugin.Stages.STAGE_INIT,
     )
     def _init(self):
         self.environment.setdefault(
+            osetupcons.SystemEnv.NFS_CONFIG_ENABLED,
+            None
+        )
+        self.environment.setdefault(
             osetupcons.SystemEnv.NFS_SERVICE_NAME,
             None
         )
+
+        #
+        # Assume we have the flag in post install
+        # on non new installation.
+        #
+        self.environment.setdefault(
+            osetupcons.SystemEnv.NFS_CONFIG_ENABLED_LEGACY_IN_POSTINSTALL,
+            self.environment[
+                osetupcons.CoreEnv.ORIGINAL_GENERATED_BY_VERSION
+            ] is not None
+        )
+
         self._enabled = True
 
     @plugin.event(
@@ -103,12 +109,23 @@
                     break
             else:
                 self._enabled = False
-        if self.environment[osetupcons.SystemEnv.NFS_CONFIG_ENABLED] is None:
+        if (
+            self.environment[
+                osetupcons.SystemEnv.NFS_CONFIG_ENABLED
+            ] is None or
+            self.environment[
+                osetupcons.SystemEnv.NFS_CONFIG_ENABLED_LEGACY_IN_POSTINSTALL
+            ]
+        ):
             if not self.environment[osetupcons.DBEnv.NEW_DATABASE]:
                 self.environment[
                     osetupcons.SystemEnv.NFS_CONFIG_ENABLED
                 ] = False
 
+        self.environment[
+            osetupcons.SystemEnv.NFS_CONFIG_ENABLED_LEGACY_IN_POSTINSTALL
+        ] = False
+
     @plugin.event(
         stage=plugin.Stages.STAGE_CUSTOMIZATION,
         name=osetupcons.Stages.SYSTEM_NFS_CONFIG_AVAILABLE,


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I907380d1d39c33ffcc43fdd49192a5096a000539
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
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