From: Luke Kanies <[EMAIL PROTECTED]>

---
 lib/puppet/provider/group/ldap.rb |    2 +-
 lib/puppet/provider/user/ldap.rb  |    2 +-
 spec/unit/provider/user/ldap.rb   |   10 ++++++++++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/lib/puppet/provider/group/ldap.rb 
b/lib/puppet/provider/group/ldap.rb
index 632358f..5af400a 100644
--- a/lib/puppet/provider/group/ldap.rb
+++ b/lib/puppet/provider/group/ldap.rb
@@ -12,7 +12,7 @@ Puppet::Type.type(:group).provide :ldap, :parent => 
Puppet::Provider::Ldap do
         as it iterates across all existing groups to pick the appropriate next
         one."
 
-    confine :true => Puppet.features.ldap?
+    confine :true => Puppet.features.ldap?, :false => (Puppet[:ldapuser] == "")
 
     # We're mapping 'members' here because we want to make it
     # easy for the ldap user provider to manage groups.  This
diff --git a/lib/puppet/provider/user/ldap.rb b/lib/puppet/provider/user/ldap.rb
index ba91a87..d670ad4 100644
--- a/lib/puppet/provider/user/ldap.rb
+++ b/lib/puppet/provider/user/ldap.rb
@@ -12,7 +12,7 @@ Puppet::Type.type(:user).provide :ldap, :parent => 
Puppet::Provider::Ldap do
         as it iterates across all existing users to pick the appropriate next
         one."
 
-    confine :true => Puppet.features.ldap?
+    confine :feature => :ldap, :false => (Puppet[:ldapuser] == "")
 
     manages(:posixAccount, :person).at("ou=People").named_by(:uid).and.maps 
:name => :uid,
         :password => :userPassword,
diff --git a/spec/unit/provider/user/ldap.rb b/spec/unit/provider/user/ldap.rb
index c4731cb..eb13d8b 100755
--- a/spec/unit/provider/user/ldap.rb
+++ b/spec/unit/provider/user/ldap.rb
@@ -24,6 +24,16 @@ describe provider_class do
         provider_class.manager.rdn.should == :uid
     end
 
+    it "should be unsuitable if ldap is unavailable" do
+        Puppet.features.expects(:ldap?).returns false
+        provider_class.should_not be_suitable
+    end
+
+    it "should be suitable if ldap is available" do
+        Puppet.features.expects(:ldap?).returns true
+        provider_class.should be_suitable
+    end
+
     {:name => "uid",
         :password => "userPassword",
         :comment => "cn",
-- 
1.5.3.3


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to