Skip to content

Commit 7965e7a

Browse files
authored
AL-5682: Improve logging for terraform (#114)
1 parent 4542da7 commit 7965e7a

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

alts/worker/runners/base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ def get_test_executor_params(self) -> dict:
659659

660660
def __terraform_init(self):
661661
with FileLock(TF_INIT_LOCK_PATH, timeout=60, thread_local=False):
662-
return local['terraform'].with_cwd(self._work_dir).run(
662+
return local['terraform'].with_env(TF_LOG='TRACE').with_cwd(self._work_dir).run(
663663
('init', '-no-color'),
664664
timeout=CONFIG.provision_timeout,
665665
)
@@ -703,7 +703,7 @@ def start_env(self):
703703
cmd_args = ['apply', '--auto-approve', '-no-color']
704704
if self.TF_VARIABLES_FILE:
705705
cmd_args.extend(['--var-file', self.TF_VARIABLES_FILE])
706-
return local['terraform'].with_cwd(self._work_dir).run(
706+
return local['terraform'].with_env(TF_LOG='TRACE').with_cwd(self._work_dir).run(
707707
args=cmd_args,
708708
retcode=None,
709709
timeout=CONFIG.provision_timeout,
@@ -1494,7 +1494,7 @@ def _stop_env(self):
14941494
cmd_args = ['destroy', '--auto-approve', '-no-color']
14951495
if self.TF_VARIABLES_FILE:
14961496
cmd_args.extend(['--var-file', self.TF_VARIABLES_FILE])
1497-
return local['terraform'].with_cwd(self._work_dir).run(
1497+
return local['terraform'].with_env(TF_LOG='TRACE').with_cwd(self._work_dir).run(
14981498
args=cmd_args,
14991499
retcode=None,
15001500
timeout=CONFIG.provision_timeout,
@@ -1715,7 +1715,7 @@ def start_env(self):
17151715
# VM gets its IP address only after deploy.
17161716
# To extract it, the `vm_ip` output should be defined
17171717
# in Terraform main file.
1718-
ip_exit_code, ip_stdout, ip_stderr = local['terraform'].with_cwd(
1718+
ip_exit_code, ip_stdout, ip_stderr = local['terraform'].with_env(TF_LOG='TRACE').with_cwd(
17191719
self._work_dir).run(
17201720
args=('output', '-raw', '-no-color', 'vm_ip'),
17211721
retcode=None,

alts/worker/runners/docker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ def clone_third_party_repo(
353353
return test_repo_path
354354

355355
def _stop_env(self):
356-
_, container_id, _ = local['terraform'].with_cwd(
356+
_, container_id, _ = local['terraform'].with_env(TF_LOG='TRACE').with_cwd(
357357
self._work_dir).run(
358358
args=('output', '-raw', '-no-color', 'container_id'),
359359
retcode=None,

alts/worker/runners/opennebula.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def _stop_env(self):
252252
'Cannot stop VM conventionally. Output:\n%s\nStderr:\n%s',
253253
stop_out, stop_err
254254
)
255-
id_exit_code, vm_id, id_stderr = local['terraform'].with_cwd(
255+
id_exit_code, vm_id, id_stderr = local['terraform'].with_env(TF_LOG='TRACE').with_cwd(
256256
self._work_dir).run(
257257
args=('output', '-raw', '-no-color', 'vm_id'),
258258
retcode=None,

0 commit comments

Comments
 (0)