Create required directories before creating a file

Change-Id: Iceac5103fa7512aeb2a9e10d7e573a200f3c33e3
Closes-bug: #1456895
This commit is contained in:
Łukasz Oleś 2015-05-20 08:02:47 +00:00
parent d1706534d4
commit 79f9135697
1 changed files with 2 additions and 0 deletions

View File

@ -16,6 +16,7 @@
require "json"
require "base64"
require 'fileutils'
require 'pathname'
module MCollective
module Agent
@ -168,6 +169,7 @@ module MCollective
def prevent_discover
lock_path = AGENT_NODISCOVER_FILE
debug_msg("Create file for discovery preventing #{lock_path}")
FileUtils.mkdir_p(Pathname.new(lock_path).dirname)
FileUtils.touch(lock_path)
end