diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-03-19 23:04:32 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-03-19 23:04:32 +0000 |
commit | 474b86c921e3fa17ffd48c3b846b2e5f3dc70640 (patch) | |
tree | c72e2021c49fcb6bd8930eefca5ed6f00b24775e /lib | |
parent | 90d8b2dfb123b42a2b1fc6104ae5d63be635bdb5 (diff) | |
download | puppet-474b86c921e3fa17ffd48c3b846b2e5f3dc70640.tar.gz puppet-474b86c921e3fa17ffd48c3b846b2e5f3dc70640.tar.xz puppet-474b86c921e3fa17ffd48c3b846b2e5f3dc70640.zip |
Hopefully the last batch of commits before I release 0.22.2. Mostly just get tests to pass.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2334 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/network/handler/master.rb | 9 | ||||
-rw-r--r-- | lib/puppet/provider.rb | 8 | ||||
-rw-r--r-- | lib/puppet/provider/user/useradd.rb | 9 | ||||
-rw-r--r-- | lib/puppet/type/service.rb | 3 | ||||
-rwxr-xr-x | lib/puppet/type/user.rb | 21 |
5 files changed, 45 insertions, 5 deletions
diff --git a/lib/puppet/network/handler/master.rb b/lib/puppet/network/handler/master.rb index c728638b2..1082d3aaa 100644 --- a/lib/puppet/network/handler/master.rb +++ b/lib/puppet/network/handler/master.rb @@ -33,6 +33,15 @@ class Puppet::Network::Handler Puppet.warning "Could not retrieve fact %s" % fact end end + + if facts["servername"].nil? + host = Facter.value(:hostname) + if domain = Facter.value(:domain) + facts["servername"] = [host, domain].join(".") + else + facts["servername"] = host + end + end end # Manipulate the client name as appropriate. diff --git a/lib/puppet/provider.rb b/lib/puppet/provider.rb index d02868d86..922cf490c 100644 --- a/lib/puppet/provider.rb +++ b/lib/puppet/provider.rb @@ -19,7 +19,7 @@ class Puppet::Provider def self.command(name) name = symbolize(name) - if command = @commands[name] + if defined?(@commands) and command = @commands[name] # nothing elsif superclass.respond_to? :command and command = superclass.command(name) # nothing @@ -89,7 +89,11 @@ class Puppet::Provider return false if @defaults.empty? if @defaults.find do |fact, values| values = [values] unless values.is_a? Array - fval = Facter.value(fact).to_s.downcase.intern + if fval = Facter.value(fact).to_s and fval != "" + fval = fval.to_s.downcase.intern + else + return false + end # If any of the values match, we're a default. if values.find do |value| fval == value.to_s.downcase.intern end diff --git a/lib/puppet/provider/user/useradd.rb b/lib/puppet/provider/user/useradd.rb index 8ed0a9bd1..d88417216 100644 --- a/lib/puppet/provider/user/useradd.rb +++ b/lib/puppet/provider/user/useradd.rb @@ -19,6 +19,15 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ has_features :manages_homedir, :allows_duplicates +# if case Facter.value(:kernel) +# when "Linux": true +# else +# false +# end +# +# has_features :manages_passwords +# end + def addcmd cmd = [command(:add)] @model.class.validproperties.each do |property| diff --git a/lib/puppet/type/service.rb b/lib/puppet/type/service.rb index 4f0b1aa74..d568fa109 100644 --- a/lib/puppet/type/service.rb +++ b/lib/puppet/type/service.rb @@ -22,6 +22,9 @@ module Puppet service depends on the platform. You can provide a special command for restarting with the ``restart`` attribute." + feature :enableable, "The provider can enable and disalbe the service", + :methods => [:disable, :enable, :enabled?] + attr_reader :stat newproperty(:enable) do diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb index c4ca0d18a..405a0b7a8 100755 --- a/lib/puppet/type/user.rb +++ b/lib/puppet/type/user.rb @@ -22,9 +22,9 @@ module Puppet feature :manages_homedir, "The provider can create and remove home directories." - feature :manages_passwords, - "The provider can modify user passwords, by accepting a password - hash." +# feature :manages_passwords, +# "The provider can modify user passwords, by accepting a password +# hash." newproperty(:ensure) do newvalue(:present, :event => :user_created) do @@ -180,6 +180,21 @@ module Puppet executable." end +# newproperty(:password) do +# desc "The user's password, in whatever format the local machine requires +# (usually crypt)." +# +# validate do |val| +# unless val.to_s == "absent" +# unless provider.class.feature?(:manages_passwords) +# raise ArgumentError, +# "The %s provider can not manage passwords on %s" % +# [provider.class.name, Facter.value(:operatingsystem)] +# end +# end +# end +# end + newproperty(:groups) do desc "The groups of which the user is a member. The primary group should not be listed. Multiple groups should be |