Update database with api_endpoints of VCA on initialization 60/9260/1
authorDavid Garcia <david.garcia@canonical.com>
Wed, 1 Jul 2020 18:25:30 +0000 (20:25 +0200)
committerDavid Garcia <david.garcia@canonical.com>
Wed, 1 Jul 2020 18:26:47 +0000 (20:26 +0200)
Change-Id: Id5666d8c93d357632efde93e8e60abafdad56e35
Signed-off-by: David Garcia <david.garcia@canonical.com>
n2vc/libjuju.py

index daedc3b..be16e2a 100644 (file)
@@ -70,7 +70,10 @@ class Libjuju:
 
         self.log = log or logging.getLogger("Libjuju")
         self.db = db
-        self.endpoints = self._get_api_endpoints_db() or [endpoint]
+        db_endpoints = self._get_api_endpoints_db()
+        self.endpoints = db_endpoints or [endpoint]
+        if db_endpoints is None:
+            self._update_api_endpoints_db(self.endpoints)
         self.api_proxy = api_proxy
         self.username = username
         self.password = password