Skip to content

Commit

Permalink
Parse version from the right value. Redirect stderr to stdout.
Browse files Browse the repository at this point in the history
Fixes #56205
  • Loading branch information
s0undt3ch authored and dwoz committed May 22, 2020
1 parent 2529710 commit 5e522c0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions salt/modules/virtualenv_mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def virtualenv_ver(venv_bin, user=None, **kwargs):
# Unable to import?? Let's parse the version from the console
version_cmd = [venv_bin, "--version"]
ret = __salt__["cmd.run_all"](
version_cmd, runas=user, python_shell=False, **kwargs
version_cmd, runas=user, python_shell=False, redirect_stderr=True, **kwargs
)
if ret["retcode"] > 0 or not ret["stdout"].strip():
raise CommandExecutionError(
Expand All @@ -74,9 +74,7 @@ def virtualenv_ver(venv_bin, user=None, **kwargs):
ver = "".join(
[x for x in ret["stdout"].strip().split() if re.search(r"^\d.\d*", x)]
)
virtualenv_version_info = tuple(
[int(i) for i in ret["stdout"].strip().split("rc")[0].split(".")]
)
virtualenv_version_info = tuple([int(i) for i in ver.split("rc")[0].split(".")])
return virtualenv_version_info


Expand Down

0 comments on commit 5e522c0

Please sign in to comment.