Use disposable temporary directories to run automation jobs
This commit is contained in:
parent
9e5280280f
commit
0ebfe28b89
5 changed files with 36 additions and 42 deletions
|
@ -43,9 +43,10 @@ class ListAutomation(TerraformAutomation):
|
|||
in the templating of the Terraform configuration.
|
||||
"""
|
||||
|
||||
def tf_generate(self) -> None:
|
||||
def tf_generate(self, working_dir) -> None:
|
||||
self.tf_write(
|
||||
self.template,
|
||||
working_dir,
|
||||
lists=MirrorList.query.filter(
|
||||
MirrorList.destroyed.is_(None),
|
||||
MirrorList.provider == self.provider,
|
||||
|
@ -65,9 +66,9 @@ class ListAutomation(TerraformAutomation):
|
|||
for pool in Pool.query.filter(Pool.destroyed.is_(None)).all():
|
||||
for key, formatter in lists.items():
|
||||
for obfuscate in [True, False]:
|
||||
with open(self.working_directory(f"{key}.{pool.pool_name}{'.jsno' if obfuscate else '.json'}"),
|
||||
with open(os.path.join(working_dir, f"{key}.{pool.pool_name}{'.jsno' if obfuscate else '.json'}"),
|
||||
'w', encoding="utf-8") as out:
|
||||
out.write(json_encode(formatter(pool), obfuscate))
|
||||
with open(self.working_directory(f"{key}.{pool.pool_name}{'.jso' if obfuscate else '.js'}"),
|
||||
with open(os.path.join(working_dir, f"{key}.{pool.pool_name}{'.jso' if obfuscate else '.js'}"),
|
||||
'w', encoding="utf-8") as out:
|
||||
out.write(javascript_encode(formatter(pool), obfuscate))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue