summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers+gitlab@digital-scurf.org>2023-08-12 09:18:25 +0000
committerDaniel Silverstone <dsilvers+gitlab@digital-scurf.org>2023-08-12 09:18:25 +0000
commitf6093a207f7f46eb547d90f2bb20113a9b009028 (patch)
tree23d91ebd4f66e20052e68b78bc8af198fe7f12ca
parentca29a91c1c867ff0c505db053c267c159268c19c (diff)
parente42ba37b63d1ca8b4d2a96e2d1b5f64316fb0b51 (diff)
downloadsubplot-f6093a207f7f46eb547d90f2bb20113a9b009028.tar.gz
Merge branch 'liw/runcmd-env-logging' into 'main'
feat: reduce repetitive logging of environment in Python runcmd See merge request subplot/subplot!348
-rw-r--r--share/python/lib/runcmd.py1
-rw-r--r--share/python/template/scenarios.py10
2 files changed, 7 insertions, 4 deletions
diff --git a/share/python/lib/runcmd.py b/share/python/lib/runcmd.py
index c4a6a12..6a4965f 100644
--- a/share/python/lib/runcmd.py
+++ b/share/python/lib/runcmd.py
@@ -70,7 +70,6 @@ def runcmd_run(ctx, argv, **kwargs):
logging.debug("runcmd_run: running command")
log_value("argv", 1, dict(enumerate(argv)))
- log_value("env", 1, env)
log_value("kwargs:", 1, kwargs)
p = subprocess.Popen(argv, env=env, **kwargs)
diff --git a/share/python/template/scenarios.py b/share/python/template/scenarios.py
index b215133..a6aa9f4 100644
--- a/share/python/template/scenarios.py
+++ b/share/python/template/scenarios.py
@@ -42,12 +42,14 @@ class Step:
self._cleanup(ctx, **self._args)
+_logged_env = False
+
+
class Scenario:
def __init__(self, ctx):
self._title = None
self._steps = []
self._ctx = ctx
- self._logged_env = False
def get_title(self):
return self._title
@@ -91,7 +93,9 @@ class Scenario:
os.environ.update(overrides)
os.environ.update(extra_env)
- if not self._logged_env:
- self._logged_env = True
+ global _logged_env
+ if not _logged_env:
+ _logged_env = True
log_value("extra_env", 0, dict(extra_env))
+ log_value("overrides", 0, dict(overrides))
log_value("os.environ", 0, dict(os.environ))