diff options
author | Vasu1105 <vasundhara.jagdale@msystechnologies.com> | 2019-09-25 14:46:17 +0530 |
---|---|---|
committer | Vasu1105 <vasundhara.jagdale@msystechnologies.com> | 2019-09-26 12:08:09 +0530 |
commit | b2fe1152aa6bc098da9cff742f2b59d604f5d79f (patch) | |
tree | 46f417c88ad4b27216249cd5cf153ff1ee1a8cbd | |
parent | 0b773e76d0681f050bd493e3603268f8f6ef3a38 (diff) | |
download | chef-b2fe1152aa6bc098da9cff742f2b59d604f5d79f.tar.gz |
MSYS-1111 Fix for knife subcommand --help don't work as intended. If we run knife acl --hel, knife group --help, knife opc --help command it does not list the commands even though this plugins are shipped with chefdk. The reason behand this is the category under which these are listed does match with the arguments passed by user. for e.g. acl commands are groued under the category OPSCODE_HOSTED_CHEF_ACCESS_CONTROL and since acl doesn't match with this category as string this does not gives valid output added a fix for this.
Signed-off-by: Vasu1105 <vasundhara.jagdale@msystechnologies.com>
-rw-r--r-- | lib/chef/knife.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb index 28634d9e44..a17137de43 100644 --- a/lib/chef/knife.rb +++ b/lib/chef/knife.rb @@ -64,6 +64,12 @@ class Chef attr_accessor :name_args attr_accessor :ui + # knife acl subcommands are grouped in this category using this constant to verify. + OPSCODE_HOSTED_CHEF_ACCESS_CONTROL = %w{acl group user}.freeze + + # knife opc subcommands are grouped in this category using this constant to verify. + CHEF_ORGANIZATION_MANAGEMENT = %w{opc}.freeze + # Configure mixlib-cli to always separate defaults from user-supplied CLI options def self.use_separate_defaults? true @@ -270,7 +276,11 @@ class Chef ui.info("If this is a recently installed plugin, please run 'knife rehash' to update the subcommands cache.") end - if category_commands = guess_category(args) + if CHEF_ORGANIZATION_MANAGEMENT.include?(args[0]) + list_commands("CHEF ORGANIZATION MANAGEMENT") + elsif OPSCODE_HOSTED_CHEF_ACCESS_CONTROL.include?(args[0]) + list_commands("OPSCODE HOSTED CHEF ACCESS CONTROL") + elsif category_commands = guess_category(args) list_commands(category_commands) elsif OFFICIAL_PLUGINS.include?(args[0]) # command was an uninstalled official chef knife plugin ui.info("Use `#{Chef::Dist::EXEC} gem install knife-#{args[0]}` to install the plugin into ChefDK") |