Enable black and pylint in tox, and update code accordingly
[osm/osmclient.git] / osmclient / sol005 / client.py
index 36062bf..a69f3cc 100644 (file)
@@ -35,9 +35,12 @@ from osmclient.sol005 import user as usermodule
 from osmclient.sol005 import role
 from osmclient.sol005 import pdud
 from osmclient.sol005 import k8scluster
+from osmclient.sol005 import vca
 from osmclient.sol005 import repo
 from osmclient.sol005 import osmrepo
+from osmclient.sol005 import subscription
 from osmclient.common import package_tool
+from osmclient.common.exceptions import ClientException
 import json
 import logging
 
@@ -95,15 +98,17 @@ class Client(object):
         self.role = role.Role(self._http_client, client=self)
         self.pdu = pdud.Pdu(self._http_client, client=self)
         self.k8scluster = k8scluster.K8scluster(self._http_client, client=self)
+        self.vca = vca.VCA(self._http_client, client=self)
         self.repo = repo.Repo(self._http_client, client=self)
         self.osmrepo = osmrepo.OSMRepo(self._http_client, client=self)
         self.package_tool = package_tool.PackageTool(client=self)
+        self.subscription = subscription.Subscription(self._http_client, client=self)
         """
         self.vca = vca.Vca(http_client, client=self, **kwargs)
         self.utils = utils.Utils(http_client, **kwargs)
         """
 
-    def get_token(self):
+    def get_token(self, pwd_change=None):
         self._logger.debug("")
         if self._token is None:
             postfields_dict = {
@@ -125,6 +130,10 @@ class Client(object):
             #                raise ClientException(message)
 
             token = json.loads(resp) if resp else None
+            if token.get("message") == "change_password" and not pwd_change:
+                raise ClientException(
+                    "Password Expired. Please update the password using change_password option"
+                )
             self._token = token["id"]
 
             if self._token is not None: