Skip to content

Commit c13bbc7

Browse files
authored
Fix python interpreter for scenario init (#4111)
When using Pyenv Virtualenv the ANSIBLE_PYTHON_INTERPRETER passed to run_command is `auto_silent` and does not resolve to the Python interpreter used by the virtualenv. Passing instead `sys.executable` seems solving the issue.
1 parent eb010f4 commit c13bbc7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/molecule/command/init/scenario.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import json
2323
import logging
2424
import os
25+
import sys
2526

2627
import click
2728

@@ -95,7 +96,7 @@ def execute(self, action_args=None):
9596
# As ansible fails to find a terminal when run by molecule, we force
9697
# it to use colors.
9798
env["ANSIBLE_FORCE_COLOR"] = "1"
98-
env["ANSIBLE_PYTHON_INTERPRETER"] = "auto_silent"
99+
env["ANSIBLE_PYTHON_INTERPRETER"] = sys.executable
99100
util.run_command(cmd, env=env, check=True)
100101

101102
msg = f"Initialized scenario in {scenario_directory} successfully."

0 commit comments

Comments
 (0)