Create destination directory on-demand i.e. when missing ...

Signed-off-by: Krzsysztof Wilczynski <krzysztof.wilczynski@linux.com>
This commit is contained in:
Krzysztof Wilczynski 2011-03-23 02:17:32 +00:00
parent c3ed006be2
commit e1bb7393bb

View file

@ -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 }