This commit is contained in:
Iain Learmonth 2023-01-21 15:15:07 +00:00
parent 6df0083842
commit 10ffdff2c3
14 changed files with 46 additions and 16 deletions

View file

@ -61,7 +61,6 @@ class BaseAutomation:
:param filename: filename to write to
:param template: Jinja2 template
:param working_dir: temporary directory for running the Terraform automation
:param kwargs: variables for use with the template
:return: None
"""

View file

@ -1,4 +1,5 @@
import datetime
from abc import ABC
from typing import List
from dateutil.parser import isoparse
@ -6,7 +7,7 @@ from dateutil.parser import isoparse
from app.terraform.block.bridge import BlockBridgeAutomation
class BlockBridgeReachabilityAutomation(BlockBridgeAutomation):
class BlockBridgeReachabilityAutomation(BlockBridgeAutomation, ABC):
_lines: List[str]

View file

@ -67,7 +67,8 @@ 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(os.path.join(self.working_dir, f"{key}.{pool.pool_name}{'.jsno' if obfuscate else '.json'}"),
with open(os.path.join(
self.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(os.path.join(self.working_dir, f"{key}.{pool.pool_name}{'.jso' if obfuscate else '.js'}"),

View file

@ -41,7 +41,6 @@ class TerraformAutomation(BaseAutomation):
5. The :func:`tf_posthook` hook is run.
6. The logs from the apply step are returned as a string.
:param working_dir: temporary directory used to run the automation
:param full: include a Terraform refresh in the automation module run
:return: success status and Terraform apply logs
"""