diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-03-01 23:09:23 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-03-01 23:09:23 +0000 |
commit | 2db23173825311bc4a9d6f69e862ce0a9c43fd40 (patch) | |
tree | f081893e98ffef11943e82c8fd7cffc2b40a2fc8 /lib/puppet | |
parent | 179779dc5045259aa28f0a9cd052d2e41cf8aa96 (diff) | |
download | puppet-2db23173825311bc4a9d6f69e862ce0a9c43fd40.tar.gz puppet-2db23173825311bc4a9d6f69e862ce0a9c43fd40.tar.xz puppet-2db23173825311bc4a9d6f69e862ce0a9c43fd40.zip |
Adding metadata to defaults
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@963 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/config.rb | 44 | ||||
-rwxr-xr-x | lib/puppet/server/filebucket.rb | 9 |
2 files changed, 35 insertions, 18 deletions
diff --git a/lib/puppet/config.rb b/lib/puppet/config.rb index dd08552a5..b165192e5 100644 --- a/lib/puppet/config.rb +++ b/lib/puppet/config.rb @@ -1,3 +1,6 @@ +require 'puppet' +require 'puppet/transportable' + module Puppet # The class for handling configuration files. class Config @@ -460,6 +463,22 @@ Generated on #{Time.now}. @value = nil end + def convert(value) + return value unless value + return value unless value.is_a? String + if value =~ /\$(\w+)/ + parent = $1 + if pval = @parent[parent] + newval = value.sub(/\$#{parent}/, pval) + return File.join(newval.split("/")) + else + raise Puppet::DevError, "Could not find value for %s" % parent + end + else + return value + end + end + def desc=(value) @desc = value.gsub(/^\s*/, '') end @@ -554,23 +573,7 @@ Generated on #{Time.now}. # A file. class CFile < CElement - attr_accessor :owner, :group, :mode - - def convert(value) - return value unless value - return value unless value.is_a? String - if value =~ /\$(\w+)/ - parent = $1 - if pval = @parent[parent] - newval = value.sub(/\$#{parent}/, pval) - return File.join(newval.split("/")) - else - raise Puppet::DevError, "Could not find value for %s" % parent - end - else - return value - end - end + attr_accessor :owner, :group, :mode, :create # Set the type appropriately. Yep, a hack. This supports either naming # the variable 'dir', or adding a slash at the end. @@ -608,7 +611,12 @@ Generated on #{Time.now}. objects = [] obj = Puppet::TransObject.new(self.value, "file") - obj[:ensure] = type + + # Only create directories, or files that are specifically marked to + # create. + if type == :directory or self.create + obj[:ensure] = type + end [:owner, :group, :mode].each { |var| if value = self.send(var) obj[var] = value diff --git a/lib/puppet/server/filebucket.rb b/lib/puppet/server/filebucket.rb index b211379f1..fc1c690fd 100755 --- a/lib/puppet/server/filebucket.rb +++ b/lib/puppet/server/filebucket.rb @@ -15,6 +15,15 @@ module Puppet class Server class BucketError < RuntimeError; end class FileBucket < Handler + Puppet.config.setdefaults("filebucket", + :bucketdir => { + :default => "$vardir/bucket", + :mode => 0770, + :owner => "$user", + :group => "$group", + :desc => "Where FileBucket files are stored." + } + ) @interface = XMLRPC::Service::Interface.new("puppetbucket") { |iface| iface.add_method("string addfile(string, string)") iface.add_method("string getfile(string)") |