lib/chef-dk/command/describe_cookbook.rb in chef-dk-3.13.1 vs lib/chef-dk/command/describe_cookbook.rb in chef-dk-4.0.60
- old
+ new
@@ -60,22 +60,23 @@
end
def run(params = [])
return 1 unless apply_params!(params)
return 1 unless check_cookbook_path
-
IdDumper.new(ui, cookbook_path).run
end
def check_cookbook_path
unless File.exist?(cookbook_path)
ui.err("Given cookbook path '#{cookbook_path}' does not exist or is not readable")
return false
end
- md_path = File.join(cookbook_path, "metadata.rb")
- unless File.exist?(md_path)
- ui.err("Given cookbook path '#{cookbook_path}' does not appear to be a cookbook, it does not contain a metadata.rb")
+ mdrb_path = File.join(cookbook_path, "metadata.rb")
+ mdjson_path = File.join(cookbook_path, "metadata.json")
+
+ unless File.exist?(mdrb_path) || File.exist?(mdjson_path)
+ ui.err("Given cookbook path '#{cookbook_path}' does not appear to be a cookbook, it does not contain a metadata.rb or metadata.json")
return false
end
true
end