Skip to content

Commit 8a1f94c

Browse files
committed
(#9440) exec resource: set path param to path fact
1 parent fc698a2 commit 8a1f94c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/puppet/type/exec.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,9 @@ def sync
223223
newparam(:path) do
224224
desc "The search path used for command execution.
225225
Commands must be fully qualified if no path is specified. Paths
226-
can be specified as an array or as a '#{File::PATH_SEPARATOR}' separated list."
226+
can be specified as an array or as a '#{File::PATH_SEPARATOR}' separated list. Defaults to the `path` fact."
227+
228+
defaultto Puppet.runtime[:facter].value('path')
227229

228230
# Support both arrays and colon-separated fields.
229231
def value=(*values)

spec/unit/type/exec_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,8 @@ def instance(path)
910910
let :abs do make_absolute('/bin/echo') end
911911
let :path do make_absolute('/bin') end
912912

913+
allow(Facter).to receive(:value).with('path').and_return('/usr/bin:/bin')
914+
913915
it "should fail with relative command and no path" do
914916
expect { type.new(:command => rel) }.
915917
to raise_error Puppet::Error, /no path was specified/

0 commit comments

Comments
 (0)