Knife supermarket install failing with NameError for constant?

I'm getting a very odd error when attempting to install cookbooks from the supermarket. I'm using the latest version of ChefDK on a recently-reimaged machine.

Google was unhelpful at diagnosing this particular error, so I'm looking here for assistance.

geoffellingwood@workstation:~/.chef$ knife supermarket install fail2ban -VVV
INFO: Using configuration from /home/geoffellingwood/.chef/knife.rb
Installing fail2ban to /home/geoffellingwood/projects/chef-repo/cookbooks
* chef-vendor-fail2ban
  master
Checking out the master branch.
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
  chef-vendor-fail2ban
* master
Pristine copy branch (chef-vendor-fail2ban) exists, switching to it.
Switched to branch 'chef-vendor-fail2ban'
Traceback (most recent call last):
        9: from /usr/bin/knife:353:in `<main>'
        8: from /usr/bin/knife:353:in `load'
        7: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.5.17/bin/knife:24:in `<top (required)>'
        6: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.5.17/lib/chef/application/knife.rb:163:in `run'
        5: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.5.17/lib/chef/knife.rb:229:in `run'
        4: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.5.17/lib/chef/knife.rb:485:in `run_with_pretty_exceptions'
        3: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.5.17/lib/chef/local_mode.rb:42:in `with_server_connectivity'
        2: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.5.17/lib/chef/knife.rb:486:in `block in run_with_pretty_exceptions'
        1: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.5.17/lib/chef/knife/supermarket_install.rb:95:in `run'
/opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.5.17/lib/chef/knife/supermarket_install.rb:140:in `download_cookbook_to': uninitialized constant Chef::Knife::CookbookSiteDownload (NameError)

Pahanda,

I'm having a hard time reproducing this in the Chef Infra codebase, but I made a fix to call the right Ruby class there. https://github.com/chef/chef/pull/9217. That should fix your issue. Also if you upgrade to Chef Workstation you'll get a newer release of Chef Infra and newer tools in general. Workstation is the replacement for ChefDK.

-Tim

Tim,

Thanks for the quick response.

Unfortunately, making the change to the Ruby file did not fix my issue:

$ knife supermarket install fail2ban -VVV
INFO: Using configuration from /home/geoffellingwood/.chef/knife.rb
Installing fail2ban to /home/geoffellingwood/projects/chef-repo/cookbooks
* chef-vendor-fail2ban
  master
Checking out the master branch.
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
  chef-vendor-fail2ban
* master
Pristine copy branch (chef-vendor-fail2ban) exists, switching to it.
Switched to branch 'chef-vendor-fail2ban'
Traceback (most recent call last):
        9: from /usr/bin/knife:353:in `<main>'
        8: from /usr/bin/knife:353:in `load'
        7: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.5.17/bin/knife:24:in `<top (required)>'
        6: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.5.17/lib/chef/application/knife.rb:163:in `run'
        5: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.5.17/lib/chef/knife.rb:229:in `run'
        4: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.5.17/lib/chef/knife.rb:485:in `run_with_pretty_exceptions'
        3: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.5.17/lib/chef/local_mode.rb:42:in `with_server_connectivity'
        2: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.5.17/lib/chef/knife.rb:486:in `block in run_with_pretty_exceptions'
        1: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.5.17/lib/chef/knife/supermarket_install.rb:95:in `run'
/opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/chef-15.5.17/lib/chef/knife/supermarket_install.rb:140:in `download_cookbook_to': uninitialized constant Chef::Knife::SupermarketDownload (NameError)

I'm going to go ahead and give Chef Workstation a try (after a clean uninstall of ChefDK) and I'll let you know how that goes...

So I found the problem, although I'm not sure quite what to make of it. Installing Chef Workstation didn't help, but it's because I had some leftover files in my ~/.chef directory (specifically, plugin_manifest.json) from a "knife rehash" run. And apparently, that file somehow managed to cause this error; I'm guessing it's overloading or overriding the module somehow. If you'd like to get a copy of what mine looked like for further troubleshooting, please let me know and I'll send it your way.

Removing that was sufficient to make knife start behaving when it comes to installing supermarket cookbooks.

Once again, thanks for the quick responses and assistance!