diff options
| author | Brice Figureau <brice-puppet@daysofwonder.com> | 2008-11-11 13:43:29 +0100 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2008-11-12 09:19:16 +1100 |
| commit | bf5be00f87a8df66964931939531399384142aff (patch) | |
| tree | 1aa6af4951d2df4a7b60cc8bbbe145de7103c661 | |
| parent | e032034fc4f5f45d883f24104c436e16ce555c0e (diff) | |
| download | puppet-bf5be00f87a8df66964931939531399384142aff.tar.gz puppet-bf5be00f87a8df66964931939531399384142aff.tar.xz puppet-bf5be00f87a8df66964931939531399384142aff.zip | |
Fix #1737 - part2 - Fix display of "options"
| -rw-r--r-- | lib/puppet/type/ssh_authorized_key.rb | 16 | ||||
| -rwxr-xr-x | spec/unit/type/ssh_authorized_key.rb | 12 |
2 files changed, 28 insertions, 0 deletions
diff --git a/lib/puppet/type/ssh_authorized_key.rb b/lib/puppet/type/ssh_authorized_key.rb index 4afca1cca..66cf3e733 100644 --- a/lib/puppet/type/ssh_authorized_key.rb +++ b/lib/puppet/type/ssh_authorized_key.rb @@ -38,6 +38,22 @@ module Puppet should be specified as an array." defaultto do :absent end + + def is_to_s(value) + if value == :absent or value.include?(:absent) + super + else + value.join(",") + end + end + + def should_to_s(value) + if value == :absent or value.include?(:absent) + super + else + value.join(",") + end + end end autorequire(:user) do diff --git a/spec/unit/type/ssh_authorized_key.rb b/spec/unit/type/ssh_authorized_key.rb index e21478479..2cd5171c9 100755 --- a/spec/unit/type/ssh_authorized_key.rb +++ b/spec/unit/type/ssh_authorized_key.rb @@ -73,6 +73,18 @@ describe ssh_authorized_key do @class.attrtype(:options).should == :property end + it "'s options property should return well formed string of arrays from is_to_s" do + resource = @class.create(:name => "whev", :type => :rsa, :user => "nobody", :options => ["a","b","c"]) + + resource.property(:options).is_to_s(["a","b","c"]).should == "a,b,c" + end + + it "'s options property should return well formed string of arrays from is_to_s" do + resource = @class.create(:name => "whev", :type => :rsa, :user => "nobody", :options => ["a","b","c"]) + + resource.property(:options).should_to_s(["a","b","c"]).should == "a,b,c" + end + it "should have a target property" do @class.attrtype(:target).should == :property end |
