Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Commit

Permalink
fix playbook for site does not work
Browse files Browse the repository at this point in the history
  • Loading branch information
Timo committed Feb 3, 2021
1 parent bec3e7e commit c2599f3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions VirtualMachineService/ancon/Playbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion VirtualMachineService/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ bibigrid:
forc:
forc_url: https://proxy-dev.bi.denbi.de:5000/

cloud_site: bielefeld
cloud_site: giessen

0 comments on commit c2599f3

Please sign in to comment.