Create destination directory on-demand i.e. when missing ...
Signed-off-by: Krzsysztof Wilczynski <krzysztof.wilczynski@linux.com>
This commit is contained in:
parent
c3ed006be2
commit
e1bb7393bb
1 changed files with 5 additions and 0 deletions
|
@ -27,6 +27,11 @@ module Puppet::Parser::Functions
|
||||||
file = "/puppet/state/crontab/#{host}-#{job}.minutes"
|
file = "/puppet/state/crontab/#{host}-#{job}.minutes"
|
||||||
file = File.join(modules, file)
|
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)
|
if FileTest.exists?(file)
|
||||||
File.open(file, 'r') { |f| value = f.read.to_i }
|
File.open(file, 'r') { |f| value = f.read.to_i }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue