From c2599f3294b9c3392df70c93fb99b2d75bc2bcf1 Mon Sep 17 00:00:00 2001 From: Timo Date: Thu, 4 Feb 2021 00:05:49 +0100 Subject: [PATCH] fix playbook for site does not work --- VirtualMachineService/ancon/Playbook.py | 20 ++++++++++---------- VirtualMachineService/config/config.yml | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/VirtualMachineService/ancon/Playbook.py b/VirtualMachineService/ancon/Playbook.py index 3d4c4f16..067f3783 100644 --- a/VirtualMachineService/ancon/Playbook.py +++ b/VirtualMachineService/ancon/Playbook.py @@ -155,11 +155,10 @@ def load_vars(): data[playbook_name + "_defined"][k] = v site_specific_yml = "/{0}{1}.yml".format(playbook_name, "-" + self.cloud_site) - playbook_yml = "" + playbook_name_local = playbook_name if os.path.isfile(self.playbooks_dir + site_specific_yml): - playbook_yml = site_specific_yml - else: - playbook_yml = "/{0}.yml".format(playbook_name) + playbook_name_local = playbook_name + "-" + self.cloud_site + playbook_yml = "/{0}.yml".format(playbook_name_local) playbook_var_yml = "/{0}_vars_file.yml".format(playbook_name) try: shutil.copy(self.playbooks_dir + playbook_yml, self.directory.name) @@ -174,26 +173,27 @@ def load_vars(): self.directory.name + playbook_var_yml, mode="w" ) as variables: self.yaml_exec.dump(data, variables) - self.add_to_playbook_lists(playbook_name) + self.add_to_playbook_lists(playbook_name_local, playbook_name) except shutil.Error as e: LOG.exception(e) - self.add_tasks_only(playbook_name) + self.add_tasks_only(playbook_name_local) except IOError as e: LOG.exception(e) - self.add_tasks_only(playbook_name) + self.add_tasks_only(playbook_name_local) except shutil.Error as e: LOG.exception(e) except IOError as e: LOG.exception(e) - def add_to_playbook_lists(self, playbook_name): + def add_to_playbook_lists(self, playbook_name_local, playbook_name): self.vars_files.append(playbook_name + "_vars_file.yml") self.tasks.append( dict( - name="Running {0} tasks".format(playbook_name), - import_tasks=playbook_name + ".yml", + name="Running {0} tasks".format(playbook_name_local), + import_tasks=playbook_name_local + ".yml", ) ) + LOG.info("Added playbook: " + playbook_name_local + ".yml" + ", vars file: " + playbook_name + "_vars_file.yml" ) def add_tasks_only(self, playbook_name): self.tasks.append( diff --git a/VirtualMachineService/config/config.yml b/VirtualMachineService/config/config.yml index a464549b..a6d28404 100644 --- a/VirtualMachineService/config/config.yml +++ b/VirtualMachineService/config/config.yml @@ -41,4 +41,4 @@ bibigrid: forc: forc_url: https://proxy-dev.bi.denbi.de:5000/ -cloud_site: bielefeld \ No newline at end of file +cloud_site: giessen