Add image_username and image_password to charms
[osm/devops.git] / installers / charm / ng-ui / src / charm.py
index 8e21bcd..6f5ca5b 100755 (executable)
 #   See the License for the specific language governing permissions and
 #   limitations under the License.
 
-import sys
-import logging
 import base64
-
-sys.path.append("lib")
+from glob import glob
+import logging
+from pathlib import Path
+from string import Template
+import sys
 
 from ops.charm import CharmBase
 from ops.framework import StoredState, Object
@@ -30,9 +31,6 @@ from ops.model import (
     WaitingStatus,
 )
 
-from glob import glob
-from pathlib import Path
-from string import Template
 
 logger = logging.getLogger(__name__)
 
@@ -129,7 +127,11 @@ class NGUICharm(CharmBase):
         ]
         port = config["https_port"] if ssl_enabled else config["port"]
         ports = [
-            {"name": "port", "containerPort": port, "protocol": "TCP", },
+            {
+                "name": "port",
+                "containerPort": port,
+                "protocol": "TCP",
+            },
         ]
 
         kubernetes = {
@@ -158,12 +160,18 @@ class NGUICharm(CharmBase):
                 }
             )
 
+        logger.debug(files)
+
         spec = {
             "version": 2,
             "containers": [
                 {
                     "name": self.framework.model.app.name,
-                    "image": "{}".format(config["image"]),
+                    "imageDetails": {
+                        "imagePath": config["image"],
+                        "username": config["image_username"],
+                        "password": config["image_password"],
+                    },
                     "ports": ports,
                     "kubernetes": kubernetes,
                     "files": files,