summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
authorAdam Edwards <adamed@opscode.com>2014-10-23 12:30:44 -0700
committerAdam Edwards <adamed@opscode.com>2014-10-23 12:30:44 -0700
commit4e9b9ff856632a16559afc52fc4651340986c2e3 (patch)
tree689b188328e2bb060cb06cf29f712534030ac6f3 /lib/chef
parent94dc0364dfa99dba3a5dbfbefeb08f41926b5468 (diff)
parenteef5c6b5cc36b6a4e92a8bd49459ad5ed7019040 (diff)
downloadchef-4e9b9ff856632a16559afc52fc4651340986c2e3.tar.gz
Merge pull request #1495 from opscode/adamed/guard-interpreter-default
guard_interpreter default change for powershell_script, batch resources
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/provider/powershell_script.rb4
-rw-r--r--lib/chef/resource/powershell_script.rb2
-rw-r--r--lib/chef/resource/windows_script.rb3
3 files changed, 6 insertions, 3 deletions
diff --git a/lib/chef/provider/powershell_script.rb b/lib/chef/provider/powershell_script.rb
index 967b2d822b..0e76cd1656 100644
--- a/lib/chef/provider/powershell_script.rb
+++ b/lib/chef/provider/powershell_script.rb
@@ -51,6 +51,8 @@ $chefscriptresult = {
}.invokereturnasis()
if ($interpolatedexitcode -and $chefscriptresult.gettype().name -eq 'boolean') { exit [int32](!$chefscriptresult) } else { exit 0 }
EOH
+ Chef::Log.debug("powershell_script provider called with script code:\n\n#{code}\n")
+ Chef::Log.debug("powershell_script provider will execute transformed code:\n\n#{@code}\n")
end
public
@@ -65,7 +67,7 @@ EOH
"-NoLogo",
"-NonInteractive",
"-NoProfile",
- "-ExecutionPolicy RemoteSigned",
+ "-ExecutionPolicy Unrestricted",
# Powershell will hang if STDIN is redirected
# http://connect.microsoft.com/PowerShell/feedback/details/572313/powershell-exe-can-hang-if-stdin-is-redirected
"-InputFormat None",
diff --git a/lib/chef/resource/powershell_script.rb b/lib/chef/resource/powershell_script.rb
index 1b47e7411a..a88fb5701b 100644
--- a/lib/chef/resource/powershell_script.rb
+++ b/lib/chef/resource/powershell_script.rb
@@ -21,8 +21,6 @@ class Chef
class Resource
class PowershellScript < Chef::Resource::WindowsScript
- set_guard_inherited_attributes(:architecture)
-
def initialize(name, run_context=nil)
super(name, run_context, :powershell_script, "powershell.exe")
@convert_boolean_return = false
diff --git a/lib/chef/resource/windows_script.rb b/lib/chef/resource/windows_script.rb
index 108891e9ba..6b0827b77c 100644
--- a/lib/chef/resource/windows_script.rb
+++ b/lib/chef/resource/windows_script.rb
@@ -23,12 +23,15 @@ class Chef
class Resource
class WindowsScript < Chef::Resource::Script
+ set_guard_inherited_attributes(:architecture)
+
protected
def initialize(name, run_context, resource_name, interpreter_command)
super(name, run_context)
@interpreter = interpreter_command
@resource_name = resource_name
+ @default_guard_interpreter = resource_name
end
include Chef::Mixin::WindowsArchitectureHelper