summaryrefslogtreecommitdiff
path: root/lib/chef/knife.rb
diff options
context:
space:
mode:
authorAlex Pop <al3xpop@gmail.com>2015-07-07 22:58:54 +0100
committerSteven Danna <steve@chef.io>2015-08-25 17:30:22 +0100
commit24987eb5691822a1773847000c41a25ed3828e7f (patch)
tree19e06c74d107fb9e5a9e4a3c09a0391af83c311b /lib/chef/knife.rb
parent7d7da108c9f53be59547c4762e5ef42422603257 (diff)
downloadchef-24987eb5691822a1773847000c41a25ed3828e7f.tar.gz
Make subcommand_not_found message loader-specific to give more helpful error message when using a plugin manifest.
Diffstat (limited to 'lib/chef/knife.rb')
-rw-r--r--lib/chef/knife.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb
index e9525c48e8..20a20d2d91 100644
--- a/lib/chef/knife.rb
+++ b/lib/chef/knife.rb
@@ -225,7 +225,13 @@ class Chef
# Error out and print usage. probably because the arguments given by the
# user could not be resolved to a subcommand.
def self.subcommand_not_found!(args)
- ui.fatal("Cannot find sub command for: '#{args.join(' ')}'")
+ ui.fatal("Cannot find subcommand for: '#{args.join(' ')}'")
+
+ # Mention rehash when the subcommands cache(plugin_manifest.json) is used
+ if subcommand_loader.is_a?(Chef::Knife::SubcommandLoader::HashedCommandLoader) ||
+ subcommand_loader.is_a?(Chef::Knife::SubcommandLoader::CustomManifestLoader)
+ ui.info("If this is a recently installed plugin, please rehash to update the subcommands cache.")
+ end
if category_commands = guess_category(args)
list_commands(category_commands)