diff options
author | Krzysztof Wilczynski <krzysztof.wilczynski@linux.com> | 2011-03-23 02:17:32 +0000 |
---|---|---|
committer | Krzysztof Wilczynski <krzysztof.wilczynski@linux.com> | 2011-03-23 02:17:32 +0000 |
commit | e1bb7393bb5e73afc1813bfe1c27f38c227a9dc3 (patch) | |
tree | 9ba7e9624f97afc147b85c5b4635db1a7d985c47 /persistent_crontab_minutes.rb | |
parent | c3ed006be2e2cbd22c0e24dd0f35e96a02e93dc5 (diff) | |
download | puppet-stdlib-e1bb7393bb5e73afc1813bfe1c27f38c227a9dc3.tar.gz puppet-stdlib-e1bb7393bb5e73afc1813bfe1c27f38c227a9dc3.tar.bz2 |
Create destination directory on-demand i.e. when missing ...
Signed-off-by: Krzsysztof Wilczynski <krzysztof.wilczynski@linux.com>
Diffstat (limited to 'persistent_crontab_minutes.rb')
-rw-r--r-- | persistent_crontab_minutes.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/persistent_crontab_minutes.rb b/persistent_crontab_minutes.rb index 44c6328..5a76868 100644 --- a/persistent_crontab_minutes.rb +++ b/persistent_crontab_minutes.rb @@ -27,6 +27,11 @@ module Puppet::Parser::Functions file = "/puppet/state/crontab/#{host}-#{job}.minutes" file = File.join(modules, file) + # Get the directory portion from the file name ... + directory = File.dirname(file) + + FileUtils.mkdir_p(directory) unless File.directory?(directory) + if FileTest.exists?(file) File.open(file, 'r') { |f| value = f.read.to_i } |