summaryrefslogtreecommitdiffstats
path: root/lib/puppet/provider/nameservice.rb
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-02-01 00:56:49 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-02-01 00:56:49 +0000
commitf1deaa8cc69a4d6255840cd2480be633635c2b86 (patch)
tree95f60f0237dffdd5d09cdca5750732de4b6f9e7a /lib/puppet/provider/nameservice.rb
parent173f5cc03640a119e77a39047cd7f4f6f0fa1a4e (diff)
downloadpuppet-f1deaa8cc69a4d6255840cd2480be633635c2b86.tar.gz
puppet-f1deaa8cc69a4d6255840cd2480be633635c2b86.tar.xz
puppet-f1deaa8cc69a4d6255840cd2480be633635c2b86.zip
Fixing autogen so it passes on non-Darwin systems.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2140 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/provider/nameservice.rb')
-rw-r--r--lib/puppet/provider/nameservice.rb19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/puppet/provider/nameservice.rb b/lib/puppet/provider/nameservice.rb
index da2de7d57..dc4aadcc9 100644
--- a/lib/puppet/provider/nameservice.rb
+++ b/lib/puppet/provider/nameservice.rb
@@ -5,6 +5,20 @@ require 'puppet'
# provides a way for them all to be as similar as possible.
class Puppet::Provider::NameService < Puppet::Provider
class << self
+ def autogen_default(param)
+ if defined? @autogen_defaults
+ return @autogen_defaults[symbolize(param)]
+ else
+ return nil
+ end
+ end
+
+ def autogen_defaults(hash)
+ @autogen_defaults ||= {}
+ hash.each do |param, value|
+ @autogen_defaults[symbolize(param)] = value
+ end
+ end
def list
objects = []
@@ -110,14 +124,15 @@ class Puppet::Provider::NameService < Puppet::Provider
end
end
- # Autogenerate a value. Mostly used for uid/gid, but also used heavily with netinfo, because netinfo is stupid.
+ # Autogenerate a value. Mostly used for uid/gid, but also used heavily
+ # with netinfo, because netinfo is stupid.
def autogen(field)
field = symbolize(field)
id_generators = {:user => :uid, :group => :gid}
if id_generators[@model.class.name] == field
return autogen_id(field)
else
- if defined?(AUTOGEN_DEFAULTS) and value = AUTOGEN_DEFAULTS[field]
+ if value = self.class.autogen_default(field)
return value
elsif respond_to?("autogen_%s" % [field])
return send("autogen_%s" % field)