Skip to content

Commit a78fdb3

Browse files
committed
Merge branch 'pr/2477'
* pr/2477: (PUP-2073) fix for multiple diff_args Closes GH-2477
2 parents 791a945 + 6dab11c commit a78fdb3

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/puppet/util/diff.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ def diff(old, new)
1010

1111
command = [diff_cmd]
1212
if args = Puppet[:diff_args] and args != ""
13-
command << args
13+
args.split(' ').each do|arg|
14+
command << arg
15+
end
1416
end
1517
command << old << new
1618
Puppet::Util::Execution.execute(command, :failonfail => false, :combine => false)

spec/unit/util/diff_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313
subject.diff('a', 'b').should == 'baz'
1414
end
1515

16+
it "should execute the diff command with multiple arguments" do
17+
Puppet[:diff] = 'foo'
18+
Puppet[:diff_args] = 'bar qux'
19+
20+
Puppet::Util::Execution.expects(:execute).with(['foo', 'bar', 'qux', 'a', 'b'], anything).returns('baz')
21+
subject.diff('a', 'b').should == 'baz'
22+
end
23+
1624
it "should omit diff arguments if none are specified" do
1725
Puppet[:diff] = 'foo'
1826
Puppet[:diff_args] = ''

0 commit comments

Comments
 (0)