Created
April 11, 2011 02:10
-
-
Save hedgehog/912977 to your computer and use it in GitHub Desktop.
Chef's Knife cli without the cli
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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