summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Deppierraz <francois.deppierraz@camptocamp.com>2009-05-08 19:52:04 +0200
committerJames Turnbull <james@lovedthanlost.net>2009-05-15 09:54:34 +1000
commit172422fc0422e2646c4cc3afb7955876651cbf3e (patch)
tree614179023a72781a8511b44c22481828ebc3ca3e
parentf945b66aee03c0c06248f3809773f444a25ff00f (diff)
Fix bug #2124 - ssh_authorized_key always changes target if target is not defined
-rw-r--r--lib/puppet/type/ssh_authorized_key.rb4
-rwxr-xr-xspec/unit/type/ssh_authorized_key.rb9
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/puppet/type/ssh_authorized_key.rb b/lib/puppet/type/ssh_authorized_key.rb
index 33ed1d62b..a16746ac4 100644
--- a/lib/puppet/type/ssh_authorized_key.rb
+++ b/lib/puppet/type/ssh_authorized_key.rb
@@ -48,6 +48,10 @@ module Puppet
return nil
end
end
+
+ def insync?(is)
+ is == should
+ end
end
newproperty(:options, :array_matching => :all) do
diff --git a/spec/unit/type/ssh_authorized_key.rb b/spec/unit/type/ssh_authorized_key.rb
index f1e9963e9..926da3c62 100755
--- a/spec/unit/type/ssh_authorized_key.rb
+++ b/spec/unit/type/ssh_authorized_key.rb
@@ -120,7 +120,14 @@ describe ssh_authorized_key do
target = File.expand_path("~root/.ssh/authorized_keys")
resource.should(:target).should == target
end
- end
+
+ # Bug #2124 - ssh_authorized_key always changes target if target is not defined
+ it "should not raise spurious change events" do
+ resource = @class.new(:name => "Test", :user => "root")
+ target = File.expand_path("~root/.ssh/authorized_keys")
+ resource.property(:target).insync?(target).should == true
+ end
+ end
describe "when calling validate" do
it "should not crash on a non-existant user" do