From: Ravi Chamarty Date: Tue, 30 Oct 2018 19:51:23 +0000 (+0000) Subject: Bug 575 Fix token refresh for VCD VIMconnector X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F01%2F6801%2F1;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 eb4e2376..44056098 100644 --- a/osm_ro/vimconn_vmware.py +++ b/osm_ro/vimconn_vmware.py @@ -6298,12 +6298,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