Add image_username and image_password to charms
[osm/devops.git] / installers / charm / pla / src / charm.py
index 785766d..16e7303 100755 (executable)
@@ -29,9 +29,6 @@ from ops.model import (
 )
 
 
-sys.path.append("lib")
-
-
 logger = logging.getLogger(__name__)
 
 
@@ -85,7 +82,11 @@ class PLACharm(CharmBase):
         config = self.framework.model.config
 
         ports = [
-            {"name": "port", "containerPort": config["port"], "protocol": "TCP", },
+            {
+                "name": "port",
+                "containerPort": config["port"],
+                "protocol": "TCP",
+            },
         ]
 
         config_spec = {
@@ -103,7 +104,11 @@ class PLACharm(CharmBase):
             "containers": [
                 {
                     "name": self.framework.model.app.name,
-                    "image": config["image"],
+                    "imageDetails": {
+                        "imagePath": config["image"],
+                        "username": config["image_username"],
+                        "password": config["image_password"],
+                    },
                     "ports": ports,
                     "config": config_spec,
                 }
@@ -136,9 +141,7 @@ class PLACharm(CharmBase):
         self._apply_spec()
 
     def on_mongo_relation_changed(self, event):
-        mongodb_uri = event.relation.data[event.unit].get(
-            "connection_string"
-        )
+        mongodb_uri = event.relation.data[event.unit].get("connection_string")
         if mongodb_uri and self.state.mongodb_uri != mongodb_uri:
             self.state.mongodb_uri = mongodb_uri
         self._apply_spec()