summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Pop <al3xpop@gmail.com>2015-07-03 17:08:53 +0100
committerSteven Danna <steve@chef.io>2015-08-25 17:30:22 +0100
commitd243fe838053fc6d142847f9fbf62d75395614d1 (patch)
tree70cc92e5891ae82180cbf01f8ac34c04a063b52c
parentc2d022ba49a65c3a70d516a137156bb23de3222a (diff)
downloadchef-d243fe838053fc6d142847f9fbf62d75395614d1.tar.gz
Recursively create the manifest directory if missing
-rw-r--r--lib/chef/knife/rehash.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/chef/knife/rehash.rb b/lib/chef/knife/rehash.rb
index 194a8002e4..41cac0a943 100644
--- a/lib/chef/knife/rehash.rb
+++ b/lib/chef/knife/rehash.rb
@@ -49,6 +49,8 @@ class Chef
end
def write_hash(data)
+ plugin_manifest_dir = File.expand_path('..', Chef::Knife::SubcommandLoader.plugin_manifest_path)
+ FileUtils.mkdir_p(plugin_manifest_dir) unless File.directory?(plugin_manifest_dir)
File.open(Chef::Knife::SubcommandLoader.plugin_manifest_path, 'w') do |f|
f.write(Chef::JSONCompat.to_json_pretty(data))
ui.msg "Knife subcommands are cached in #{Chef::Knife::SubcommandLoader.plugin_manifest_path}. Delete this file to disable the caching."