Sandro Bonazzola has uploaded a new change for review.

Change subject: packaging: setup: added upgrade from legacy plugin
......................................................................

packaging: setup: added upgrade from legacy plugin

Added a plugin for detecting if we are upgrading from a
system installed using legacy setup.
It sets the environment variable CoreEnv.UPGRADE_FROM_LEGACY.

Change-Id: I4ee25f561218d83c5a4bd821c2d89587df5bc47a
Signed-off-by: Sandro Bonazzola <[email protected]>
---
M packaging/setup/ovirt_engine_setup/constants.py
M packaging/setup/plugins/ovirt-engine-setup/core/__init__.py
A packaging/setup/plugins/ovirt-engine-setup/core/legacy.py
3 files changed, 58 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/75/15975/1

diff --git a/packaging/setup/ovirt_engine_setup/constants.py 
b/packaging/setup/ovirt_engine_setup/constants.py
index 52166c3..55185c4 100644
--- a/packaging/setup/ovirt_engine_setup/constants.py
+++ b/packaging/setup/ovirt_engine_setup/constants.py
@@ -536,6 +536,7 @@
     REGISTER_UNINSTALL_GROUPS = 'OVESETUP_CORE/registerUninstallGroups'
     CONFIRM_UNINSTALL_GROUPS = 'OVESETUP_CORE/confirmUninstallGroups'
     UPGRADE_SUPPORTED_VERSIONS = 'OVESETUP_CORE/upgradeSupportedVersions'
+    UPGRADE_FROM_LEGACY = 'OVESETUP_CORE/upgradeFromLegacy'
 
     @osetupattrs(
         answerfile=True,
diff --git a/packaging/setup/plugins/ovirt-engine-setup/core/__init__.py 
b/packaging/setup/plugins/ovirt-engine-setup/core/__init__.py
index 124d003..db278ae 100644
--- a/packaging/setup/plugins/ovirt-engine-setup/core/__init__.py
+++ b/packaging/setup/plugins/ovirt-engine-setup/core/__init__.py
@@ -25,6 +25,7 @@
 from . import misc
 from . import uninstall
 from . import postinstall
+from . import legacy
 
 
 @util.export
@@ -32,6 +33,7 @@
     misc.Plugin(context=context)
     uninstall.Plugin(context=context)
     postinstall.Plugin(context=context)
+    legacy.Plugin(context=context)
 
 
 # vim: expandtab tabstop=4 shiftwidth=4
diff --git a/packaging/setup/plugins/ovirt-engine-setup/core/legacy.py 
b/packaging/setup/plugins/ovirt-engine-setup/core/legacy.py
new file mode 100644
index 0000000..e1605c4
--- /dev/null
+++ b/packaging/setup/plugins/ovirt-engine-setup/core/legacy.py
@@ -0,0 +1,55 @@
+#
+# ovirt-engine-setup -- ovirt engine setup
+# Copyright (C) 2013 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+"""Upgrade from legacy plugin."""
+
+
+import os
+import gettext
+_ = lambda m: gettext.dgettext(message=m, domain='ovirt-engine-setup')
+
+
+from otopi import util
+from otopi import plugin
+
+
+from ovirt_engine_setup import constants as osetupcons
+
+
[email protected]
+class Plugin(plugin.PluginBase):
+    """Upgrade from legacy plugin."""
+
+    def __init__(self, context):
+        super(Plugin, self).__init__(context=context)
+
+    @plugin.event(
+        stage=plugin.Stages.STAGE_INIT,
+    )
+    def _init(self):
+        self.environment[osetupcons.CoreEnv.UPGRADE_FROM_LEGACY] = (
+            os.path.exists(
+                osetupcons.FileLocations.OVIRT_ENGINE_PKI_ENGINE_CA_CERT
+            ) and
+            not os.path.exists(
+                osetupcons.FileLocations.OVIRT_SETUP_POST_INSTALL_CONFIG
+            )
+        )
+
+
+# vim: expandtab tabstop=4 shiftwidth=4


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4ee25f561218d83c5a4bd821c2d89587df5bc47a
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Sandro Bonazzola <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to