summaryrefslogtreecommitdiffstats
path: root/lib/puppet/config.rb
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-03-01 23:09:23 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-03-01 23:09:23 +0000
commit2db23173825311bc4a9d6f69e862ce0a9c43fd40 (patch)
treef081893e98ffef11943e82c8fd7cffc2b40a2fc8 /lib/puppet/config.rb
parent179779dc5045259aa28f0a9cd052d2e41cf8aa96 (diff)
downloadpuppet-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/config.rb')
-rw-r--r--lib/puppet/config.rb44
1 files changed, 26 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