diff --git a/lib/chef/knife/inventory_chef_client.rb b/lib/chef/knife/inventory_chef_client.rb index ead4f30..e860821 100644 --- a/lib/chef/knife/inventory_chef_client.rb +++ b/lib/chef/knife/inventory_chef_client.rb @@ -43,7 +43,7 @@ def search_args rows: max_results, filter_result: { name: ["name"], - chef_version: %w[chef_packages chef version], + chef_version: %w(chef_packages chef version), ohai_time: ["ohai_time"] } } diff --git a/lib/chef/knife/inventory_cookbook.rb b/lib/chef/knife/inventory_cookbook.rb index f1aecbb..a9a5128 100644 --- a/lib/chef/knife/inventory_cookbook.rb +++ b/lib/chef/knife/inventory_cookbook.rb @@ -27,8 +27,16 @@ def run @cookbook_version = name_args[1] @show_env_constraints = config[:env_constraints] - unless @cookbook_name - ui.error "You need to specify a cookbook" + if @cookbook_name + cookbook_object = search_nodes("cookbooks_#{@cookbook_name}:*") + if cookbook_object.to_s == "[]" + ui.fatal "The cookbook name you provided #{cookbook_name} does not exist on the Chef server." + show_usage + exit 1 + end + else + ui.fatal "You did not specify a cookbook. You need to specify a cookbook." + show_usage exit 1 end diff --git a/tasks/changelog.rake b/tasks/changelog.rake index 82a932e..b74b3a4 100644 --- a/tasks/changelog.rake +++ b/tasks/changelog.rake @@ -7,9 +7,9 @@ begin GitHubChangelogGenerator::RakeTask.new :changelog do |config| config.future_release = "v#{Knife::ChefInventory::VERSION}" config.issues = false - config.enhancement_labels = %w[enhancement] - config.bug_labels = %w[bug] - config.exclude_labels = %w[no_changelog] + config.enhancement_labels = %w(enhancement) + config.bug_labels = %w(bug) + config.exclude_labels = %w(no_changelog) end rescue LoadError puts "Problem loading gems please install chef and github_changelog_generator"