Skip to content

Commit 6015494

Browse files
committed
Merge pull request #123 from derekhiggins/empty-opts
Allow an empty hash for options
2 parents c8ade3f + 7d4cd7b commit 6015494

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

lib/puppet/provider/network_config/redhat.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def self.munge(pairs)
168168
end
169169

170170
# For all of the remaining values, blindly toss them into the options hash.
171-
props[:options] = pairs unless pairs.empty?
171+
props[:options] = pairs
172172

173173
[:onboot, :hotplug].each do |bool_property|
174174
if props[bool_property]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
BOOTPROTO=dhcp
2+
ONBOOT=yes
3+
DEVICE=eth1
4+
HOTPLUG=yes

spec/unit/provider/network_config/redhat_spec.rb

+6-1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ def fixture_data(file)
9494
it { data[:options]["NM_CONTROLLED"].should == 'no' }
9595
end
9696

97+
describe 'with no extra options' do
98+
let(:data) { described_class.parse_file('eth0', fixture_data('eth1-simple'))[0] }
99+
it { data[:options].should == {} }
100+
end
101+
97102
describe 'complex configuration' do
98103
let(:virbonding_path) { File.join(PROJECT_ROOT, 'spec', 'fixtures', 'provider', 'network_config', 'redhat_spec', 'virbonding') }
99104

@@ -199,7 +204,7 @@ def fixture_data(file)
199204
its(:netmask) { should == '255.255.255.0' }
200205
its(:onboot) { should == :absent }
201206
its(:method) { should == 'static' }
202-
its(:options) { should == :absent }
207+
its(:options) { should == {} }
203208
end
204209

205210
describe 'vlan200' do

0 commit comments

Comments
 (0)