summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-04-02 21:58:19 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-04-02 21:58:19 +0000
commit72774bbd4ade3d249970cf049d3824c6891ac66e (patch)
tree268ca1d35f5e8c331e201efac337893ee09bce87 /lib
parente6f9163c543c19756887b7be04e01fb51789070e (diff)
downloadpuppet-72774bbd4ade3d249970cf049d3824c6891ac66e.tar.gz
puppet-72774bbd4ade3d249970cf049d3824c6891ac66e.tar.xz
puppet-72774bbd4ade3d249970cf049d3824c6891ac66e.zip
adding mkdir equivalent of Config#write
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1052 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/config.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/puppet/config.rb b/lib/puppet/config.rb
index 18bd21693..638f1d34f 100644
--- a/lib/puppet/config.rb
+++ b/lib/puppet/config.rb
@@ -174,6 +174,23 @@ class Config
@created = []
end
+ # Make a directory with the appropriate user, group, and mode
+ def mkdir(default)
+ obj = nil
+ unless obj = @config[default]
+ raise ArgumentError, "Unknown default %s" % default
+ end
+
+ unless obj.is_a? CFile
+ raise ArgumentError, "Default %s is not a file" % default
+ end
+
+ Puppet::Util.asuser(obj.owner, obj.group) do
+ mode = obj.mode || 0750
+ Dir.mkdir(obj.value, mode)
+ end
+ end
+
# Return all of the parameters associated with a given section.
def params(section)
section = section.intern if section.is_a? String