From 9ce35c519a34c601fdb8d506b78ef6cfe8ac7acc Mon Sep 17 00:00:00 2001 From: Philipp Herzog Date: Thu, 7 Nov 2024 14:15:33 +0100 Subject: [PATCH] add env to Run component --- CHANGES.d/20241107_141439_ph_run_with_env.md | 1 + src/batou_ext/run.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 CHANGES.d/20241107_141439_ph_run_with_env.md diff --git a/CHANGES.d/20241107_141439_ph_run_with_env.md b/CHANGES.d/20241107_141439_ph_run_with_env.md new file mode 100644 index 0000000..83f24fe --- /dev/null +++ b/CHANGES.d/20241107_141439_ph_run_with_env.md @@ -0,0 +1 @@ +- add an env argument for the `Run` component to support running commands with specific environment variables diff --git a/src/batou_ext/run.py b/src/batou_ext/run.py index 3bd0069..8b8633c 100644 --- a/src/batou_ext/run.py +++ b/src/batou_ext/run.py @@ -31,6 +31,7 @@ class Run(batou.component.Component): namevar = "command" content = None file = None + env = None def configure(self): @@ -55,5 +56,5 @@ def verify(self): def update(self): self.touch(self.command_file.path) - self.cmd(self.command_file.path) + self.cmd(self.command_file.path, env=self.env) self.touch(f"{self.command_file.path}_stamp")