diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2017-04-05 20:02:33 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2017-04-06 10:03:15 -0700 |
commit | d3d4ddb596bd4fb87a9ab659112134bd431d3ea9 (patch) | |
tree | 031c6309c4aa179af8755f6708eb1a8092684767 | |
parent | afa4237dbf47996345dafb93da45163bf3673df0 (diff) | |
download | chef-d3d4ddb596bd4fb87a9ab659112134bd431d3ea9.tar.gz |
switch guards to use shell_out_with_systems_locale
matches the execute resource usage.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r-- | lib/chef/guard_interpreter/default_guard_interpreter.rb | 6 | ||||
-rw-r--r-- | spec/unit/resource/conditional_spec.rb | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/chef/guard_interpreter/default_guard_interpreter.rb b/lib/chef/guard_interpreter/default_guard_interpreter.rb index 449ca9a316..f93c0e04f0 100644 --- a/lib/chef/guard_interpreter/default_guard_interpreter.rb +++ b/lib/chef/guard_interpreter/default_guard_interpreter.rb @@ -1,6 +1,6 @@ # # Author:: Adam Edwards (<adamed@chef.io>) -# Copyright:: Copyright 2014-2016, Chef Software, Inc. +# Copyright:: Copyright 2014-2017, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -33,7 +33,9 @@ class Chef public def evaluate - shell_out(@command, @command_opts).status.success? + shell_out_with_systems_locale(@command, @command_opts).status.success? + # Timeout fails command rather than chef-client run, see: + # https://tickets.opscode.com/browse/CHEF-2690 rescue Chef::Exceptions::CommandTimeout Chef::Log.warn "Command '#{@command}' timed out" false diff --git a/spec/unit/resource/conditional_spec.rb b/spec/unit/resource/conditional_spec.rb index 135f798676..0219945936 100644 --- a/spec/unit/resource/conditional_spec.rb +++ b/spec/unit/resource/conditional_spec.rb @@ -92,7 +92,7 @@ describe Chef::Resource::Conditional do describe "after running a command which timed out" do before do @conditional = Chef::Resource::Conditional.only_if(@parent_resource, "false") - allow_any_instance_of(Chef::GuardInterpreter::DefaultGuardInterpreter).to receive(:shell_out).and_raise(Chef::Exceptions::CommandTimeout) + allow_any_instance_of(Chef::GuardInterpreter::DefaultGuardInterpreter).to receive(:shell_out_with_systems_locale).and_raise(Chef::Exceptions::CommandTimeout) end it "indicates that resource convergence should not continue" do @@ -195,7 +195,7 @@ describe Chef::Resource::Conditional do describe "after running a command which timed out" do before do @conditional = Chef::Resource::Conditional.not_if(@parent_resource, "false") - allow_any_instance_of(Chef::GuardInterpreter::DefaultGuardInterpreter).to receive(:shell_out).and_raise(Chef::Exceptions::CommandTimeout) + allow_any_instance_of(Chef::GuardInterpreter::DefaultGuardInterpreter).to receive(:shell_out_with_systems_locale).and_raise(Chef::Exceptions::CommandTimeout) end it "indicates that resource convergence should continue" do |