lib/cuken/api/chef/knife.rb in cuken-0.1.12 vs lib/cuken/api/chef/knife.rb in cuken-0.1.13
- old
+ new
@@ -70,47 +70,15 @@
CliTemplate.option(:config_file, :long => '--config CONFIG', :default => conf)
CliTemplate.option(:no_editor, :long => "--no-editor", :boolean => true, :default => true)
CliTemplate.option(:yes, :long => "--yes", :boolean => true, :default => true)
end
- def create_client(client_name)
- chef.client_private_key_path = chef.root_dir + "/.chef/#{client_name}.pem"
- data = {:name => client_name,
- :admin => true,
- :file => chef.client_private_key_path,
- :no_editor => true,
- :config_file => chef.knife_config_file}
- argv = ['client', 'create', data[:name], '--file', data[:file], '--config', data[:config_file],'--no-editor']
- argv << '--admin' if data[:admin]
- unless Pathname(chef.client_private_key_path).exist?
- with_args *argv do
- ::Chef::Application::Knife.new.run # (args, CliTemplate.options)
- end
- else
- #TODO: Verify client exists on the Chef server, and has matching public key.
- end
- end
-
def show_client(client_name)
chef.client_private_key_path = chef.root_dir + "/.chef/#{client_name}.pem"
data = {:name => client_name,
:config_file => chef.knife_config_file}
argv = ['client', 'show', data[:name], '--config', data[:config_file],'--no-editor']
argv << '--admin' if data[:admin]
- with_args *argv do
- ::Chef::Application::Knife.new.run # (args, CliTemplate.options)
- end
- end
-
- def delete_client(client_name)
- chef.client_private_key_path = chef.root_dir + "/.chef/#{client_name}.pem"
- data = {:name => client_name,
- :file => chef.client_private_key_path,
- :no_editor => true,
- :yes => true,
- :print_after => true,
- :config_file => chef.knife_config_file}
- argv = ['client', 'delete', data[:name], '--no-editor', '--yes' ]
with_args *argv do
::Chef::Application::Knife.new.run
end
end