Skip to content

Instantly share code, notes, and snippets.

@hedgehog
Created April 11, 2011 02:10
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save hedgehog/912977 to your computer and use it in GitHub Desktop.
Chef's Knife cli without the cli
class KnifeCliTemplate
include Mixlib::CLI
end
data = {...}
KnifeCliTemplate.option(:config_file, :long => '--file FILE', :default => '/etc/chef/knife.rb')
KnifeCliTemplate.option(:no_editor, :long => "--no-editor", :boolean => true)
args = ['client', 'create', data[:name], '--file', data[:file], '--no-editor' ]
args << '--admin' if data[:admin]
::Chef::Knife.run(args,KnifeCliTemplate.options)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment