From 74c43c94cfe44a74d1e445d20a49c27065fea1a4 Mon Sep 17 00:00:00 2001 From: Chris Church Date: Wed, 18 Jun 2014 11:18:44 -0500 Subject: [PATCH] Allow specifying remote powershell version via environment variable. --- lib/ansible/runner/shell_plugins/powershell.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/ansible/runner/shell_plugins/powershell.py b/lib/ansible/runner/shell_plugins/powershell.py index 031077215e..eead8d50b1 100644 --- a/lib/ansible/runner/shell_plugins/powershell.py +++ b/lib/ansible/runner/shell_plugins/powershell.py @@ -24,6 +24,12 @@ import time _common_args = ['PowerShell', '-NoProfile', '-NonInteractive'] +# Primarily for testing, allow explicitly specifying PowerShell version via +# an environment variable. +_powershell_version = os.environ.get('POWERSHELL_VERSION', None) +if _powershell_version: + _common_args = ['PowerShell', '-Version', _powershell_version] + _common_args[1:] + def _escape(value, include_vars=False): '''Return value escaped for use in PowerShell command.''' # http://www.techotopia.com/index.php/Windows_PowerShell_1.0_String_Quoting_and_Escape_Sequences