Simone Tiraboschi has uploaded a new change for review.

Change subject: packaging: setup: better exception handling on APIs connection
......................................................................

packaging: setup: better exception handling on APIs connection

Better handling of APIs connection errors better discriminating
and reporting them.

Change-Id: I13a286ffaac955b821de830a4562413ee071c860
Signed-off-by: Simone Tiraboschi <[email protected]>
---
M src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
1 file changed, 31 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup 
refs/changes/95/35595/1

diff --git a/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py 
b/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
index 19d9069..231b11b 100644
--- a/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
+++ b/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py
@@ -484,7 +484,38 @@
                     ohostedcons.EngineEnv.TEMPORARY_CERT_FILE
                 ],
             )
+        except ovirtsdk.infrastructure.errors.RequestError as e:
+            self.logger.debug(
+                _(
+                    'Cannot connect to engine APIs on {fqdn}'
+                ).format(
+                    fqdn=self.environment[
+                        ohostedcons.NetworkEnv.OVIRT_HOSTED_ENGINE_FQDN
+                    ],
+                ),
+            )
+            self.logger.error(
+                _(
+                    'Cannot connect to engine APIs on {fqdn}:\n '
+                    '{details}\n'
+                ).format(
+                    fqdn=self.environment[
+                        ohostedcons.NetworkEnv.OVIRT_HOSTED_ENGINE_FQDN
+                    ],
+                    details=e.detail
+                )
+            )
+            raise RuntimeError(
+                _(
+                    'Cannot connect to engine APIs on {fqdn}'
+                ).format(
+                    fqdn=self.environment[
+                        ohostedcons.NetworkEnv.OVIRT_HOSTED_ENGINE_FQDN
+                    ],
+                )
+            )
 
+        try:
             conn = vdscli.connect()
             net_info = netinfo.NetInfo(vds_info.capabilities(conn))
             bridge_port = self.environment[ohostedcons.NetworkEnv.BRIDGE_IF]


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

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

Reply via email to