Skip to content

Commit 6c1d42c

Browse files
Merge pull request #1267 from puppetlabs/MODULES-11580
(MODULES-11580) Do not combine stderr and stdout when scanning rules
2 parents f2b3c6d + 3c381b3 commit 6c1d42c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lib/puppet/provider/firewall/firewall.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ def self.get_rules(context, basic, protocols = ['IPv4', 'IPv6'])
472472
# For each protocol
473473
protocols.each do |protocol|
474474
# Retrieve String containing all information
475-
iptables_list = Puppet::Provider.execute($list_command[protocol])
475+
iptables_list = Puppet::Provider.execute($list_command[protocol], combine: false, failonfail: true)
476476
# Scan String to retrieve all Rules
477477
iptables_list.scan($table_regex).each do |table|
478478
table_name = table[0].scan($table_name_regex)[0][0]

spec/unit/puppet/provider/firewall/firewall_output_parsing_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,8 @@
344344
end
345345

346346
it 'processes the resource' do
347-
allow(Puppet::Util::Execution).to receive(:execute).with('iptables-save').and_return(iptables)
348-
allow(Puppet::Util::Execution).to receive(:execute).with('ip6tables-save').and_return(ip6tables)
347+
allow(Puppet::Util::Execution).to receive(:execute).with('iptables-save', { combine: false, failonfail: true }).and_return(iptables)
348+
allow(Puppet::Util::Execution).to receive(:execute).with('ip6tables-save', { combine: false, failonfail: true }).and_return(ip6tables)
349349

350350
expect(provider.get(context)).to eq(returned_data)
351351
end

spec/unit/puppet/provider/firewallchain/firewallchain_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,8 @@
326326
},
327327
].each do |test|
328328
before(:each) do
329-
allow(Puppet::Util::Execution).to receive(:execute).with('iptables-save').and_return(iptables)
330-
allow(Puppet::Util::Execution).to receive(:execute).with('ip6tables-save').and_return(ip6tables)
329+
allow(Puppet::Util::Execution).to receive(:execute).with('iptables-save', { combine: false, failonfail: true }).and_return(iptables)
330+
allow(Puppet::Util::Execution).to receive(:execute).with('ip6tables-save', { combine: false, failonfail: true }).and_return(ip6tables)
331331
end
332332

333333
it "purge chain: '#{test[:should]}'" do

0 commit comments

Comments
 (0)