From 8caa1a33dd78e08667b45286b84d67bc229b02db Mon Sep 17 00:00:00 2001 From: fabacab Date: Tue, 19 Sep 2023 17:27:29 -0400 Subject: [PATCH 1/3] Include `env` variables defined in a `dependency` in the step itself. Prior to this commit, a `dependency` defined by the `molecule.yaml` file would not honor the values in its `env` map. Consider the following: ```yaml dependency: name: shell command: env env: FOO: bar ``` Invoking `molecule test` would show that `FOO` is not set during the run of this dependency. The cause was the fact that these values were never actually passed to the `util.run_command()` invocation. This also means `MOLECULE_EPHEMERAL_DIRECTORY` and similar `MOLECULE_*` environment variables that are defined by the dependency's `default_env` property were also never available to the dependency's environment. --- src/molecule/dependency/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/molecule/dependency/base.py b/src/molecule/dependency/base.py index 911176fad..603c43a27 100644 --- a/src/molecule/dependency/base.py +++ b/src/molecule/dependency/base.py @@ -54,7 +54,7 @@ def execute_with_retries(self): exception = None try: - util.run_command(self._sh_command, debug=self._config.debug, check=True) + util.run_command(self._sh_command, debug=self._config.debug, check=True, env=self.env) msg = "Dependency completed successfully." LOG.info(msg) return @@ -71,7 +71,7 @@ def execute_with_retries(self): self.SLEEP += self.BACKOFF try: - util.run_command(self._sh_command, debug=self._config.debug, check=True) + util.run_command(self._sh_command, debug=self._config.debug, check=True, env=self.env) msg = "Dependency completed successfully." LOG.info(msg) return From 88071dd1ea9f51dd4919318c2cf0c4c95d81738f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 19 Sep 2023 21:36:17 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/molecule/dependency/base.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/molecule/dependency/base.py b/src/molecule/dependency/base.py index 603c43a27..e11af4855 100644 --- a/src/molecule/dependency/base.py +++ b/src/molecule/dependency/base.py @@ -54,7 +54,9 @@ def execute_with_retries(self): exception = None try: - util.run_command(self._sh_command, debug=self._config.debug, check=True, env=self.env) + util.run_command( + self._sh_command, debug=self._config.debug, check=True, env=self.env, + ) msg = "Dependency completed successfully." LOG.info(msg) return @@ -71,7 +73,9 @@ def execute_with_retries(self): self.SLEEP += self.BACKOFF try: - util.run_command(self._sh_command, debug=self._config.debug, check=True, env=self.env) + util.run_command( + self._sh_command, debug=self._config.debug, check=True, env=self.env, + ) msg = "Dependency completed successfully." LOG.info(msg) return From ba94914a527885c7dddb662736cf62848bdc5b18 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 14 Nov 2023 09:16:39 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/molecule/dependency/base.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/molecule/dependency/base.py b/src/molecule/dependency/base.py index e11af4855..a442e6d79 100644 --- a/src/molecule/dependency/base.py +++ b/src/molecule/dependency/base.py @@ -55,7 +55,10 @@ def execute_with_retries(self): try: util.run_command( - self._sh_command, debug=self._config.debug, check=True, env=self.env, + self._sh_command, + debug=self._config.debug, + check=True, + env=self.env, ) msg = "Dependency completed successfully." LOG.info(msg) @@ -74,7 +77,10 @@ def execute_with_retries(self): try: util.run_command( - self._sh_command, debug=self._config.debug, check=True, env=self.env, + self._sh_command, + debug=self._config.debug, + check=True, + env=self.env, ) msg = "Dependency completed successfully." LOG.info(msg)