From f8cc2b4fb2182f228308aa5ff5b64a1fa5bd9dc1 Mon Sep 17 00:00:00 2001 From: Ravi Chamarty Date: Tue, 30 Oct 2018 19:51:23 +0000 Subject: [PATCH 1/1] Bug 575 Fix token refresh for VCD VIMconnector Change-Id: I10ba41f3e4361410eba050a028ce7d8e015ef673 Signed-off-by: Ravi Chamarty --- osm_ro/vimconn_vmware.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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 -- 2.25.1