summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/chef/knife/acl_base.rb1
-rw-r--r--lib/chef/knife/core/subcommand_loader.rb15
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/chef/knife/acl_base.rb b/lib/chef/knife/acl_base.rb
index 0835d1ac05..d9a0a222c3 100644
--- a/lib/chef/knife/acl_base.rb
+++ b/lib/chef/knife/acl_base.rb
@@ -22,6 +22,7 @@ require_relative "../knife"
class Chef
class Knife
module AclBase
+ Kernel.puts "LOADING ANYWAY HAHAHAH"
PERM_TYPES = %w{create read update delete grant}.freeze unless defined? PERM_TYPES
MEMBER_TYPES = %w{client group user}.freeze unless defined? MEMBER_TYPES
diff --git a/lib/chef/knife/core/subcommand_loader.rb b/lib/chef/knife/core/subcommand_loader.rb
index 26d7e0277c..6a67711d7f 100644
--- a/lib/chef/knife/core/subcommand_loader.rb
+++ b/lib/chef/knife/core/subcommand_loader.rb
@@ -111,7 +111,20 @@ class Chef
load_commands
end
- def load_command(_command_args)
+ def load_command(command_args)
+ return true if @loaded
+ cmd_words = positional_arguments(command_args)
+ partial_path = "#{cmd_words.join("_")}.rb"
+
+ # Take a best shot at loading the command before falling back to loading
+ # all commands.
+ subcommand_files.each do |file|
+ if file.end_with?(partial_path)
+ @loaded = true
+ Kernel.load file
+ end
+ end
+ # If we've set @loaded, this will noop
load_commands
end