Skip to content

Commit

Permalink
remove unnecessary quotes which are causing pain
Browse files Browse the repository at this point in the history
Resolves: #53
  • Loading branch information
Jeremy Kitchen authored and Dominic Cleal committed Oct 5, 2013
1 parent 532abef commit 29f212d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/puppet/provider/sysctl/augeas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def self.sysctl_set(key, value)
if Facter.value(:kernel) == :openbsd
sysctl("#{key}=#{value}")
else
sysctl('-w', %Q{#{key}="#{value}"})
sysctl('-w', %Q{#{key}=#{value}})
end
end

Expand Down
24 changes: 12 additions & 12 deletions spec/unit/puppet/sysctl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
after(:all) { FileUtils.remove_entry_secure @tmpdir }

before :each do
provider_class.expects(:sysctl).with('-w', 'net.ipv4.ip_forward="1"')
provider_class.expects(:sysctl).with('-w', 'net.ipv4.ip_forward=1')
provider_class.expects(:sysctl).with('-n', 'net.ipv4.ip_forward').returns('1')
end

Expand All @@ -39,7 +39,7 @@
let(:target) { tmptarget.path }

before :each do
provider_class.expects(:sysctl).with('-w', 'net.ipv4.ip_forward="1"')
provider_class.expects(:sysctl).with('-w', 'net.ipv4.ip_forward=1')
provider_class.expects(:sysctl).with('-n', 'net.ipv4.ip_forward').returns('1')
end

Expand Down Expand Up @@ -109,7 +109,7 @@

it "should create new entry next to commented out entry" do
provider_class.expects(:sysctl).with('-n', 'net.bridge.bridge-nf-call-iptables').returns('1')
provider_class.expects(:sysctl).with('-w', 'net.bridge.bridge-nf-call-iptables="1"')
provider_class.expects(:sysctl).with('-w', 'net.bridge.bridge-nf-call-iptables=1')
apply!(Puppet::Type.type(:sysctl).new(
:name => "net.bridge.bridge-nf-call-iptables",
:value => "1",
Expand All @@ -127,7 +127,7 @@

it "should equate multi-part values with tabs in" do
provider_class.expects(:sysctl).with('-n', 'kernel.sem').returns("150\t12000\t12\t1000")
provider_class.expects(:sysctl).with('-w', 'kernel.sem="150 12000 12 1000"')
provider_class.expects(:sysctl).with('-w', 'kernel.sem=150 12000 12 1000')

apply!(Puppet::Type.type(:sysctl).new(
:name => "kernel.sem",
Expand Down Expand Up @@ -159,7 +159,7 @@
context 'when system and config values are set to different values' do
it "should update value with augeas and sysctl" do
provider_class.expects(:sysctl).with('-n', 'net.ipv4.ip_forward').twice.returns('3').then.returns('1')
provider_class.expects(:sysctl).with('-w', 'net.ipv4.ip_forward="1"')
provider_class.expects(:sysctl).with('-w', 'net.ipv4.ip_forward=1')

apply!(Puppet::Type.type(:sysctl).new(
:name => "net.ipv4.ip_forward",
Expand All @@ -179,7 +179,7 @@

it "should update value with augeas only" do
provider_class.expects(:sysctl).with('-n', 'net.ipv4.ip_forward').never
provider_class.expects(:sysctl).with('-w', 'net.ipv4.ip_forward="1"').never
provider_class.expects(:sysctl).with('-w', 'net.ipv4.ip_forward=1').never

apply!(Puppet::Type.type(:sysctl).new(
:name => "net.ipv4.ip_forward",
Expand All @@ -201,7 +201,7 @@
context 'when system and config values are set to the same value' do
it "should update value with augeas and sysctl" do
provider_class.expects(:sysctl).with('-n', 'net.ipv4.ip_forward').twice.returns('0').then.returns('1')
provider_class.expects(:sysctl).with('-w', 'net.ipv4.ip_forward="1"')
provider_class.expects(:sysctl).with('-w', 'net.ipv4.ip_forward=1')

apply!(Puppet::Type.type(:sysctl).new(
:name => "net.ipv4.ip_forward",
Expand All @@ -221,7 +221,7 @@

it "should update value with augeas only" do
provider_class.expects(:sysctl).with('-n', 'net.ipv4.ip_forward').never
provider_class.expects(:sysctl).with('-w', 'net.ipv4.ip_forward="1"').never
provider_class.expects(:sysctl).with('-w', 'net.ipv4.ip_forward=1').never

apply!(Puppet::Type.type(:sysctl).new(
:name => "net.ipv4.ip_forward",
Expand All @@ -244,7 +244,7 @@
it "should update value with augeas only" do
provider_class.expects(:sysctl).with('-n', 'net.ipv4.ip_forward').twice.returns('1')
# Values not in sync, system update forced anyway
provider_class.expects(:sysctl).with('-w', 'net.ipv4.ip_forward="1"').once.returns('1')
provider_class.expects(:sysctl).with('-w', 'net.ipv4.ip_forward=1').once.returns('1')

apply!(Puppet::Type.type(:sysctl).new(
:name => "net.ipv4.ip_forward",
Expand All @@ -264,7 +264,7 @@

it "should update value with augeas only and never run sysctl" do
provider_class.expects(:sysctl).with('-n', 'net.ipv4.ip_forward').never
provider_class.expects(:sysctl).with('-w', 'net.ipv4.ip_forward="1"').never
provider_class.expects(:sysctl).with('-w', 'net.ipv4.ip_forward=1').never

apply!(Puppet::Type.type(:sysctl).new(
:name => "net.ipv4.ip_forward",
Expand All @@ -287,7 +287,7 @@
it "should update value with sysctl only" do
provider_class.expects(:sysctl).with('-n', 'net.ipv4.ip_forward').twice.returns('1').then.returns('0')
# Values not in sync, system update forced anyway
provider_class.expects(:sysctl).with('-w', 'net.ipv4.ip_forward="0"').once.returns('0')
provider_class.expects(:sysctl).with('-w', 'net.ipv4.ip_forward=0').once.returns('0')

apply!(Puppet::Type.type(:sysctl).new(
:name => "net.ipv4.ip_forward",
Expand All @@ -307,7 +307,7 @@

it "should not update value with sysctl" do
provider_class.expects(:sysctl).with('-n', 'net.ipv4.ip_forward').never
provider_class.expects(:sysctl).with('-w', 'net.ipv4.ip_forward="0"').never
provider_class.expects(:sysctl).with('-w', 'net.ipv4.ip_forward=0').never

apply!(Puppet::Type.type(:sysctl).new(
:name => "net.ipv4.ip_forward",
Expand Down

0 comments on commit 29f212d

Please sign in to comment.