diff --git a/lib/puppet/provider/network_config/interfaces.rb b/lib/puppet/provider/network_config/interfaces.rb index 6c6e6be7..94fe164d 100644 --- a/lib/puppet/provider/network_config/interfaces.rb +++ b/lib/puppet/provider/network_config/interfaces.rb @@ -279,9 +279,9 @@ def self.format_file(filename, providers) if provider.options provider.options.each_pair do |key, val| if val.is_a? String - stanza << "#{key} #{val}" + stanza << " #{key} #{val}" elsif val.is_a? Array - val.each { |entry| stanza << "#{key} #{entry}" } + val.each { |entry| stanza << " #{key} #{entry}" } else raise Puppet::Error, "#{self} options key #{key} expects a String or Array, got #{val.class}" end diff --git a/spec/unit/provider/network_config/interfaces_spec.rb b/spec/unit/provider/network_config/interfaces_spec.rb index 536c70b1..26d65e1a 100644 --- a/spec/unit/provider/network_config/interfaces_spec.rb +++ b/spec/unit/provider/network_config/interfaces_spec.rb @@ -237,7 +237,7 @@ def fixture_data(file) end it "should write the value as an modified string" do - content.scan(/^pre-up .*$/).first.should == "pre-up /bin/touch /tmp/eth1-up" + content.scan(/^\s*pre-up .*$/).first.should == " pre-up /bin/touch /tmp/eth1-up" end end @@ -247,8 +247,8 @@ def fixture_data(file) end it "should write the values in order" do - content.scan(/^post-down .*$/)[0].should == "post-down /bin/touch /tmp/eth1-down1" - content.scan(/^post-down .*$/)[1].should == "post-down /bin/touch /tmp/eth1-down2" + content.scan(/^\s*post-down .*$/)[0].should == " post-down /bin/touch /tmp/eth1-down1" + content.scan(/^\s*post-down .*$/)[1].should == " post-down /bin/touch /tmp/eth1-down2" end end end