From 0353f726766c6a79a1dd05a37e44a3a1f1eb12ad Mon Sep 17 00:00:00 2001 From: Modulos Date: Sun, 14 May 2017 12:44:36 +0200 Subject: [PATCH] Try connection --- opennebula_api/models.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/opennebula_api/models.py b/opennebula_api/models.py index e225ce0f..ac2da393 100644 --- a/opennebula_api/models.py +++ b/opennebula_api/models.py @@ -84,8 +84,11 @@ class OpenNebulaManager(): vm_pool.info() except AttributeError: logger.info('Could not connect via client, using oneadmin instead') - vm_pool = oca.VirtualMachinePool(self.oneadmin_client) - vm_pool.info(filter=-2) + try: + vm_pool = oca.VirtualMachinePool(self.oneadmin_client) + vm_pool.info(filter=-2) + except: + raise ConnectionRefusedError except ConnectionRefusedError: logger.info('Could not connect to host: {host} via protocol {protocol}'.format(