Simone Tiraboschi has uploaded a new change for review.

Change subject: packaging: setup: Improoving support for unattended setup
......................................................................

packaging: setup: Improoving support for unattended setup

Handling REMOTE_ENGINE_HOST from answer file.

Change-Id: Ic20c9fc375867fdfb6d299b3d09cd7fc14d380bc
Signed-off-by: Simone Tiraboschi <stira...@redhat.com>
---
M packaging/setup/ovirt_engine_setup/websocket_proxy/constants.py
M packaging/setup/plugins/ovirt-engine-setup/websocket_proxy/config.py
M packaging/setup/plugins/ovirt-engine-setup/websocket_proxy/pki.py
3 files changed, 40 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/92/32292/1

diff --git a/packaging/setup/ovirt_engine_setup/websocket_proxy/constants.py 
b/packaging/setup/ovirt_engine_setup/websocket_proxy/constants.py
index b655f4f..6f64b27 100644
--- a/packaging/setup/ovirt_engine_setup/websocket_proxy/constants.py
+++ b/packaging/setup/ovirt_engine_setup/websocket_proxy/constants.py
@@ -123,7 +123,12 @@
 
     KEY_SIZE = 'OVESETUP_CONFIG/keySize'
 
-    REMOTE_ENGINE_HOST = 'OVESETUP_CONFIG/remoteEngineHost'
+    @osetupattrs(
+        answerfile=True,
+        summary=False,
+    )
+    def REMOTE_ENGINE_HOST(self):
+        return 'OVESETUP_CONFIG/remoteEngineHost'
 
     WSP_CERTIFICATE_CHAIN = 'OVESETUP_CONFIG/wspCertificateChain'
     REMOTE_ENGINE_CER = 'OVESETUP_CONFIG/remoteEngineCer'
diff --git 
a/packaging/setup/plugins/ovirt-engine-setup/websocket_proxy/config.py 
b/packaging/setup/plugins/ovirt-engine-setup/websocket_proxy/config.py
index 4950bf2..adc0ede 100644
--- a/packaging/setup/plugins/ovirt-engine-setup/websocket_proxy/config.py
+++ b/packaging/setup/plugins/ovirt-engine-setup/websocket_proxy/config.py
@@ -62,6 +62,10 @@
             owspcons.ConfigEnv.WEBSOCKET_PROXY_HOST,
             'localhost'
         )
+        self.environment.setdefault(
+            owspcons.ConfigEnv.WEBSOCKET_PROXY_CONFIG,
+            None
+        )
 
     @plugin.event(
         stage=plugin.Stages.STAGE_SETUP,
diff --git a/packaging/setup/plugins/ovirt-engine-setup/websocket_proxy/pki.py 
b/packaging/setup/plugins/ovirt-engine-setup/websocket_proxy/pki.py
index a8d9216..cc1cff7 100644
--- a/packaging/setup/plugins/ovirt-engine-setup/websocket_proxy/pki.py
+++ b/packaging/setup/plugins/ovirt-engine-setup/websocket_proxy/pki.py
@@ -88,6 +88,10 @@
             owspcons.ConfigEnv.KEY_SIZE,
             owspcons.Defaults.DEFAULT_KEY_SIZE
         )
+        self.environment.setdefault(
+            owspcons.ConfigEnv.REMOTE_ENGINE_HOST,
+            None
+        )
 
     @plugin.event(
         stage=plugin.Stages.STAGE_VALIDATION,
@@ -180,6 +184,7 @@
                     ],
                 )
             )
+            self._need_cert = True
 
         if self._need_cert:
             self.dialog.note(
@@ -317,17 +322,29 @@
 
         if self._on_separate_h:
             self.logger.debug('Acquiring engine.crt from the engine')
+            if self.environment[
+                owspcons.ConfigEnv.REMOTE_ENGINE_HOST
+            ] is None:
+                _interactive = True
+            else:
+                _interactive = False
+            remote_engine_host = None
             while not self.environment[
                 owspcons.ConfigEnv.REMOTE_ENGINE_CER
             ]:
-                remote_engine_host = self.dialog.queryString(
-                    name='REMOTE_ENGINE_HOST',
-                    note=_(
-                        'Please provide the FQDN or IP '
-                        'of the remote engine host: '
-                    ),
-                    prompt=True,
-                )
+                if _interactive:
+                    remote_engine_host = self.dialog.queryString(
+                        name='REMOTE_ENGINE_HOST',
+                        note=_(
+                            'Please provide the FQDN or IP '
+                            'of the remote engine host: '
+                        ),
+                        prompt=True,
+                    )
+                else:
+                    remote_engine_host = self.environment[
+                        owspcons.ConfigEnv.REMOTE_ENGINE_HOST
+                    ]
 
                 with contextlib.closing(
                     urllib2.urlopen(
@@ -344,6 +361,11 @@
                             owspcons.ConfigEnv.REMOTE_ENGINE_CER
                         ] = engine_cer
 
+            if _interactive:
+                self.environment[
+                    owspcons.ConfigEnv.REMOTE_ENGINE_HOST
+                ] = remote_engine_host
+
             self.environment[
                 otopicons.CoreEnv.MAIN_TRANSACTION
             ].append(


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic20c9fc375867fdfb6d299b3d09cd7fc14d380bc
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Simone Tiraboschi <stira...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to