From: Ravi Chamarty Date: Tue, 30 Oct 2018 19:51:23 +0000 (+0000) Subject: Bug 575 Fix token refresh for VCD VIMconnector X-Git-Tag: v5.0.0~11 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=b7ff355a95cf7ce07874aa5dc1d4267541277778;p=osm%2FRO.git Bug 575 Fix token refresh for VCD VIMconnector Change-Id: I10ba41f3e4361410eba050a028ce7d8e015ef673 Signed-off-by: Ravi Chamarty --- diff --git a/osm_ro/vimconn_vmware.py b/osm_ro/vimconn_vmware.py index 30c9908e..c65482bc 100644 --- a/osm_ro/vimconn_vmware.py +++ b/osm_ro/vimconn_vmware.py @@ -6327,12 +6327,18 @@ class vimconnector(vimconn.vimconnector): Returns org and vdc object """ - org = Org(self.client, resource=self.client.get_org()) - vdc = org.get_vdc(self.tenant_name) + vdc = None + try: + org = Org(self.client, resource=self.client.get_org()) + vdc = org.get_vdc(self.tenant_name) + except Exception as e: + # pyvcloud not giving a specific exception, Refresh nevertheless + self.logger.debug("Received exception {}, refreshing token ".format(str(e))) #Retry once, if failed by refreshing token if vdc is None: self.get_token() + org = Org(self.client, resource=self.client.get_org()) vdc = org.get_vdc(self.tenant_name) return org, vdc