auto/terraform: straight up return a string for logs

This commit is contained in:
Iain Learmonth 2022-05-15 18:46:14 +01:00
parent 3e4862e142
commit f96bbcf49d

View file

@ -29,7 +29,7 @@ class TerraformAutomation(BaseAutomation):
def tf_apply(self, *,
refresh: bool = True,
parallelism: Optional[int] = None,
lock_timeout: int = 15) -> Tuple[int, List[Dict[str, Any]]]:
lock_timeout: int = 15) -> Tuple[int, str]:
if not parallelism:
parallelism = self.parallelism
tf = subprocess.run(
@ -43,11 +43,7 @@ class TerraformAutomation(BaseAutomation):
],
cwd=self.working_directory(),
stdout=subprocess.PIPE)
logs = []
for line in tf.stdout.decode('utf-8').split('\n'):
if line.strip():
logs.append(json.loads(line))
return tf.returncode, str(logs)
return tf.returncode, tf.stdout.decode('utf-8')
def tf_generate(self):
raise NotImplementedError()