diff options
-rwxr-xr-x | lib/puppet/type/user.rb | 5 | ||||
-rwxr-xr-x | spec/unit/type/user.rb | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb index 28b1631cb..2b082ee94 100755 --- a/lib/puppet/type/user.rb +++ b/lib/puppet/type/user.rb @@ -245,6 +245,11 @@ module Puppet autos end + # Provide an external hook. Yay breaking out of APIs. + def exists? + provider.exists? + end + def retrieve absent = false properties().inject({}) { |prophash, property| diff --git a/spec/unit/type/user.rb b/spec/unit/type/user.rb index bf2af23ab..deabd4746 100755 --- a/spec/unit/type/user.rb +++ b/spec/unit/type/user.rb @@ -41,6 +41,12 @@ describe user do it "should have a valid provider" do user.new(:name => "foo").provider.class.ancestors.should be_include(Puppet::Provider) end + + it "should delegate existence questions to its provider" do + instance = user.new(:name => "foo") + instance.provider.expects(:exists?).returns "eh" + instance.exists?.should == "eh" + end end properties = [:ensure, :uid, :gid, :home, :comment, :shell, :password, :groups, :roles, :auths, :profiles, :project, :keys] |