Sandro Bonazzola has uploaded a new change for review.

Change subject: packaging: setup: upgrade fqdn configuration
......................................................................

packaging: setup: upgrade fqdn configuration

Added automatic fqdn configuration when upgrading
from legacy setup.

Change-Id: I8649f244b41493591bdbece1f28d306206ba40bc
Signed-off-by: Sandro Bonazzola <[email protected]>
---
M packaging/fedora/setup/engine-upgrade.py
M packaging/setup/plugins/ovirt-engine-setup/config/hostname.py
2 files changed, 29 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/79/15979/1

diff --git a/packaging/fedora/setup/engine-upgrade.py 
b/packaging/fedora/setup/engine-upgrade.py
index 64c1501..72e64a6 100755
--- a/packaging/fedora/setup/engine-upgrade.py
+++ b/packaging/fedora/setup/engine-upgrade.py
@@ -1103,6 +1103,17 @@
     handler.open()
     try:
         fqdn = handler.getParam('ENGINE_FQDN')
+        if fqdn == None:
+            raise RuntimeError(
+                (
+                    'Incomplete configuration detected: '
+                    'missing {key} in {filename}. Please manually fix '
+                    'the configuration file adding the missing key.'
+                ).format(
+                    key='ENGINE_FQDN',
+                    filename=conf_file
+                )
+            )
         proxyEnabled = handler.getParam('ENGINE_PROXY_ENABLED') == 'true'
     finally:
         handler.close()
diff --git a/packaging/setup/plugins/ovirt-engine-setup/config/hostname.py 
b/packaging/setup/plugins/ovirt-engine-setup/config/hostname.py
index 6b48d02..2cb5d82 100644
--- a/packaging/setup/plugins/ovirt-engine-setup/config/hostname.py
+++ b/packaging/setup/plugins/ovirt-engine-setup/config/hostname.py
@@ -30,6 +30,7 @@
 
 
 from ovirt_engine_setup import constants as osetupcons
+from ovirt_engine_setup import util as osetuputil
 
 
 @util.export
@@ -109,6 +110,8 @@
             $
         """
     )
+
+    _CA_FQDN_RE = re.compile('CA-(?P<fqdn>[\w.]+)\.[0-9]+')
 
     def __init__(self, context):
         super(Plugin, self).__init__(context=context)
@@ -318,6 +321,21 @@
         ],
     )
     def _customization(self):
+        if self.environment[osetupcons.CoreEnv.UPGRADE_FROM_LEGACY]:
+            config = osetuputil.ConfigFile([
+                osetupcons.FileLocations.OVIRT_ENGINE_SERVICE_CONFIG
+            ])
+            fqdn = config.get('ENGINE_FQDN')
+            if fqdn:
+                self.environment[osetupcons.ConfigEnv.FQDN] = fqdn
+            else:
+                #Maybe we can read it from ca.pem ?
+                self.logger.error(
+                    _(
+                        'Incomplete configuration detected: the '
+                        'Host fully qualified DNS name is not defined.'
+                    )
+                )
         interactive = self.environment[osetupcons.ConfigEnv.FQDN] is None
         validFQDN = False
         while not validFQDN:


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

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