Skip to content

Commit

Permalink
Merge pull request #123 from derekhiggins/empty-opts
Browse files Browse the repository at this point in the history
Allow an empty hash for options
  • Loading branch information
igalic committed Oct 28, 2015
2 parents c8ade3f + 7d4cd7b commit 6015494
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/puppet/provider/network_config/redhat.rb
Expand Up @@ -168,7 +168,7 @@ def self.munge(pairs)
end

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

[:onboot, :hotplug].each do |bool_property|
if props[bool_property]
Expand Down
4 changes: 4 additions & 0 deletions spec/fixtures/provider/network_config/redhat_spec/eth1-simple
@@ -0,0 +1,4 @@
BOOTPROTO=dhcp
ONBOOT=yes
DEVICE=eth1
HOTPLUG=yes
7 changes: 6 additions & 1 deletion spec/unit/provider/network_config/redhat_spec.rb
Expand Up @@ -94,6 +94,11 @@ def fixture_data(file)
it { data[:options]["NM_CONTROLLED"].should == 'no' }
end

describe 'with no extra options' do
let(:data) { described_class.parse_file('eth0', fixture_data('eth1-simple'))[0] }
it { data[:options].should == {} }
end

describe 'complex configuration' do
let(:virbonding_path) { File.join(PROJECT_ROOT, 'spec', 'fixtures', 'provider', 'network_config', 'redhat_spec', 'virbonding') }

Expand Down Expand Up @@ -199,7 +204,7 @@ def fixture_data(file)
its(:netmask) { should == '255.255.255.0' }
its(:onboot) { should == :absent }
its(:method) { should == 'static' }
its(:options) { should == :absent }
its(:options) { should == {} }
end

describe 'vlan200' do
Expand Down

0 comments on commit 6015494

Please sign in to comment.