diff --git a/VirtualMachineService/ancon/Playbook.py b/VirtualMachineService/ancon/Playbook.py index 83a9df06..1f31e2f8 100644 --- a/VirtualMachineService/ancon/Playbook.py +++ b/VirtualMachineService/ancon/Playbook.py @@ -57,6 +57,8 @@ def __init__( ) self.returncode = -1 self.playbooks_information = playbooks_information + LOG.exception(self.playbooks_information) + self.stdout = "" self.stderr = "" # init temporary directories and mandatory generic files @@ -132,8 +134,7 @@ def copy_playbooks_and_init(self, playbooks_information, public_key): def copy_and_init(self, playbook_name, playbook_vars): def load_vars(): - LOG.info(f"Playbook vars: {playbook_vars}") - + LOG.info(f" Playbook vars: {playbook_vars}") if playbook_name == CONDA: for k, v in playbook_vars.items(): if k == "packages": @@ -146,16 +147,16 @@ def load_vars(): data[playbook_name + "_vars"][k] = p_dict if playbook_name in self.loaded_metadata_keys: for k, v in playbook_vars.items(): + LOG.info(playbook_vars) if k == "template_version": data[playbook_name + "_vars"][k] = v - elif k == "create_only_backend": - create_only_backend = data[playbook_name + "_vars"][k] - if create_only_backend in ["false", "False"]: + if k == "create_only_backend": + if playbook_vars[k] in ["false", "False"]: data[playbook_name + "_vars"][k] = False - elif create_only_backend in ["true", "True"]: + elif playbook_vars[k] in ["true", "True"]: data[playbook_name + "_vars"][k] = True - elif k == "base_url": + if k == "base_url": data[playbook_name + "_vars"][k] = v if playbook_name == OPTIONAL: @@ -176,17 +177,15 @@ def load_vars(): playbook_name_local = playbook_name if os.path.isfile(self.directory.name + site_specific_yml): playbook_name_local = playbook_name + "-" + self.cloud_site - original_playbook_var_yml = f"{self.playbooks_dir}/{playbook_name}/{playbook_name}_vars_file.yml" + playbook_var_yml = f"/{playbook_name}_vars_file.yml" - LOG.info("Remove copy of vars file") - os.remove(self.directory.name + playbook_var_yml) try: - with open(original_playbook_var_yml, mode="r") as original_vars_yml: - data = self.yaml_exec.load(original_vars_yml) + with open(self.directory.name + playbook_var_yml, mode="r") as variables: + data = self.yaml_exec.load(variables) load_vars() - with open(self.directory.name + playbook_var_yml, mode="w") as playbook_variables_yml: - self.yaml_exec.dump(data, playbook_variables_yml) + with open(self.directory.name + playbook_var_yml, mode="w") as variables: + self.yaml_exec.dump(data, variables) self.add_to_playbook_lists(playbook_name_local, playbook_name) except shutil.Error as e: LOG.exception(e)