+ # params for use in -f file
+ # returns values file option and filename (in order to delete it at the end)
+ def _params_to_file_option(self, cluster_uuid: str, params: dict) -> (str, str):
+
+ if params and len(params) > 0:
+ kube_dir, helm_dir, config_filename, cluster_dir = \
+ self._get_paths(cluster_name=cluster_uuid, create_if_not_exist=True)
+
+ def get_random_number():
+ r = random.randrange(start=1, stop=99999999)
+ s = str(r)
+ while len(s) < 10:
+ s = '0' + s
+ return s
+
+ params2 = dict()
+ for key in params:
+ value = params.get(key)
+ if '!!yaml' in str(value):
+ value = yaml.load(value[7:])
+ params2[key] = value
+
+ values_file = get_random_number() + '.yaml'
+ with open(values_file, 'w') as stream:
+ yaml.dump(params2, stream, indent=4, default_flow_style=False)
+
+ return '-f {}'.format(values_file), values_file
+
+ return '', None
+