Chef

Plugin System for Knife

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 0.8.16
  • Fix Version/s: 0.9.14, 0.10.0
  • Component/s: None
  • Labels:
    None
  • Triage Status:
    Triaged

Description

Knife should have the ability to load commands from arbitrary directories.

Chatting with the folks on IRC, people want the following behaviors/features:

  • There should be a "site-plugins" plugin directory, ~/.chef/knife-plugins/ for example, so users can hack something up and have it work right away without additional packaging/hassle
  • for knife plugins that are distributed as gems or installed to the ruby load path, plugins should be opt-in

Opt-in can be accomplished with a set of knife plugin commands, like {{knife plugin [list,enable,disable]}} or some autodetect feature that asks for user confirmation either on first time knife is run after plugin install, or via a "command_missing" type system where the user runs knife $new_plugin_command and knife would find it if missing and prompt for install.

I'm kinda partial to the {{knife plugin [list,enable,disable]}} approach, as I think it's more discoverable--you can find what plugins you have available without knowing their exact names in advance.

Activity

Hide
Adam Jacob added a comment - 31/May/10 4:50 AM

Awesome.

I just added per-directory knife configurations, some of which might become useful in this as well.

Show
Adam Jacob added a comment - 31/May/10 4:50 AM Awesome. I just added per-directory knife configurations, some of which might become useful in this as well.
Hide
Daniel DeLeo added a comment - 18/Jun/10 2:16 AM

didn't make the cut for 0.9.0, hopefully I can finish it for 0.9.2

Show
Daniel DeLeo added a comment - 18/Jun/10 2:16 AM didn't make the cut for 0.9.0, hopefully I can finish it for 0.9.2
Hide
Daniel DeLeo added a comment - 27/Jun/10 3:23 AM

bulk reassigning to 0.9.4

Show
Daniel DeLeo added a comment - 27/Jun/10 3:23 AM bulk reassigning to 0.9.4
Hide
Daniel DeLeo added a comment - 23/Jul/10 10:16 PM

I'm attacking this one in three parts now:

  1. rewrite the subcommand loader to accept subcommands that are not in the Chef::Knife namespace and not in the chef/lib/chef/knife/ directory
  2. refactor the user interaction code to have cleaner, more consistent interfaces and output
  3. create a plugin manager so users can opt-in to plugins from gems

The first task is done, which means that 3rd party subcommands can actually be used with the current knife in master, though the programming interfaces are subject to change so it may be a rough ride.

Show
Daniel DeLeo added a comment - 23/Jul/10 10:16 PM I'm attacking this one in three parts now:
  1. rewrite the subcommand loader to accept subcommands that are not in the Chef::Knife namespace and not in the chef/lib/chef/knife/ directory
  2. refactor the user interaction code to have cleaner, more consistent interfaces and output
  3. create a plugin manager so users can opt-in to plugins from gems
The first task is done, which means that 3rd party subcommands can actually be used with the current knife in master, though the programming interfaces are subject to change so it may be a rough ride.
Hide
Akzhan Abdulin added a comment - 03/Sep/10 12:05 PM

We need this feature.

Of course all cloud extensions should be rewritten as plugins as live examples to extend Knife.

I suppose that all gems named chef-knifeplugin-XXX should be automatically discovered and loaded at knife startup.

Show
Akzhan Abdulin added a comment - 03/Sep/10 12:05 PM We need this feature. Of course all cloud extensions should be rewritten as plugins as live examples to extend Knife. I suppose that all gems named chef-knifeplugin-XXX should be automatically discovered and loaded at knife startup.
Hide
Daniel DeLeo added a comment - 19/Oct/10 9:44 PM

bulk updating fix versions to next release

Show
Daniel DeLeo added a comment - 19/Oct/10 9:44 PM bulk updating fix versions to next release
Hide
Eric Hodel added a comment - 22/Jan/11 1:38 AM

I have fulfilled part of the requirements for this ticket:

https://github.com/opscode/chef/pull/49

Show
Eric Hodel added a comment - 22/Jan/11 1:38 AM I have fulfilled part of the requirements for this ticket: https://github.com/opscode/chef/pull/49
Hide
Eric Hodel added a comment - 08/Feb/11 11:49 PM

Per kallistec on IRC: just close [this ticket] and we'll track the refactor effort in a separate ticket as necessary

Show
Eric Hodel added a comment - 08/Feb/11 11:49 PM Per kallistec on IRC: just close [this ticket] and we'll track the refactor effort in a separate ticket as necessary
Hide
Seth Chisamore added a comment - 18/Feb/11 10:32 PM - edited

I expanded on Eric's enhancement and search for knife subcommand files upward in .chef/plugins/knife/*.rb and in ~/.chef/plugins/knife/*.rb

My patch on his patch can be pulled from here:
https://github.com/schisamo/chef/tree/CHEF-1248

Show
Seth Chisamore added a comment - 18/Feb/11 10:32 PM - edited I expanded on Eric's enhancement and search for knife subcommand files upward in .chef/plugins/knife/*.rb and in ~/.chef/plugins/knife/*.rb My patch on his patch can be pulled from here: https://github.com/schisamo/chef/tree/CHEF-1248
Hide
Seth Chisamore added a comment - 19/Feb/11 1:14 AM

If you would like to use this patch in the current version of chef use this patched knife bin file:
https://gist.github.com/f33e15bac2820dd572d4

This can just be placed in the root of your chef-repo (and given the proper execute permissions).

Show
Seth Chisamore added a comment - 19/Feb/11 1:14 AM If you would like to use this patch in the current version of chef use this patched knife bin file: https://gist.github.com/f33e15bac2820dd572d4 This can just be placed in the root of your chef-repo (and given the proper execute permissions).
Hide
Daniel DeLeo added a comment - 22/Feb/11 10:57 PM

Merged. Thanks to everyone who contributed to this!

https://github.com/opscode/chef/commit/77b5614c7d0178e5e481c538117645e597f1cd37

Show
Daniel DeLeo added a comment - 22/Feb/11 10:57 PM Merged. Thanks to everyone who contributed to this! https://github.com/opscode/chef/commit/77b5614c7d0178e5e481c538117645e597f1cd37
Hide
Seth Chisamore added a comment - 05/Mar/11 3:02 PM

For those that are interested, the first plugin using this functionality has been released, "knife-windows":
https://rubygems.org/gems/knife-windows
https://github.com/opscode/knife-windows

Show
Seth Chisamore added a comment - 05/Mar/11 3:02 PM For those that are interested, the first plugin using this functionality has been released, "knife-windows": https://rubygems.org/gems/knife-windows https://github.com/opscode/knife-windows

People

Vote (4)
Watch (5)

Dates

  • Created:
    25/May/10 4:26 PM
    Updated:
    05/Mar/11 3:02 PM
    Resolved:
    08/Feb/11 11:49 PM