Bug 2064 fixed
[osm/N2VC.git] / n2vc / k8s_helm3_conn.py
index 8bfd173..74a8947 100644 (file)
@@ -19,6 +19,7 @@
 # For those usages not covered by the Apache License, Version 2.0 please
 # contact with: nfvlabs@tid.es
 ##
+from typing import Union
 import os
 import yaml
 
@@ -83,7 +84,12 @@ class K8sHelm3Connector(K8sHelmBaseConnector):
         """Install a helm chart
 
         :param cluster_uuid str: The UUID of the cluster to install to
-        :param kdu_model str: The name or path of a bundle to install
+        :param kdu_model str: chart/reference (string), which can be either
+            of these options:
+            - a name of chart available via the repos known by OSM
+              (e.g. stable/openldap, stable/openldap:1.2.4)
+            - a path to a packaged chart (e.g. mychart.tgz)
+            - a path to an unpacked chart directory or a URL (e.g. mychart)
         :param kdu_instance: Kdu instance name
         :param atomic bool: If set, waits until the model is active and resets
                             the cluster on failure.
@@ -347,6 +353,19 @@ class K8sHelm3Connector(K8sHelmBaseConnector):
     def _get_inspect_command(
         self, inspect_command: str, kdu_model: str, repo_str: str, version: str
     ):
+        """Generates the command to obtain the information about an Helm Chart package
+            (´helm show ...´ command)
+
+        Args:
+            show_command: the second part of the command (`helm show <show_command>`)
+            kdu_model: The name or path of an Helm Chart
+            repo_url: Helm Chart repository url
+            version: constraint with specific version of the Chart to use
+
+        Returns:
+            str: the generated Helm Chart command
+        """
+
         inspect_command = "{} show {} {}{} {}".format(
             self._helm_command, inspect_command, kdu_model, repo_str, version
         )
@@ -367,9 +386,9 @@ class K8sHelm3Connector(K8sHelmBaseConnector):
         cluster_id: str,
         kdu_instance: str,
         namespace: str = None,
+        yaml_format: bool = False,
         show_error_log: bool = False,
-        return_text: bool = False,
-    ):
+    ) -> Union[str, dict]:
 
         self.log.debug(
             "status of kdu_instance: {}, namespace: {} ".format(kdu_instance, namespace)
@@ -393,7 +412,7 @@ class K8sHelm3Connector(K8sHelmBaseConnector):
             env=env,
         )
 
-        if return_text:
+        if yaml_format:
             return str(output)
 
         if rc != 0: