lib/cuken/api/chef/knife.rb in cuken-0.1.8 vs lib/cuken/api/chef/knife.rb in cuken-0.1.9

- old
+ new

@@ -60,11 +60,11 @@ 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.config_file} + :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) @@ -75,11 +75,11 @@ 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.config_file} + :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 @@ -90,11 +90,11 @@ data = {:name => client_name, :file => chef.client_private_key_path, :no_editor => true, :yes => true, :print_after => true, - :config_file => chef.config_file} + :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 @@ -108,39 +108,39 @@ nd.should be_an_instance_of(::Chef::Node) nd.name.should == node_name end def node_show(node_name, attr = :all) - Pathname(chef.config_file).exist?.should be_true - argv = ['node', 'show', node_name, '--no-editor', '--config', chef.config_file] + Pathname(chef.knife_config_file).exist?.should be_true + argv = ['node', 'show', node_name, '--no-editor', '--config', chef.knife_config_file] unless attr == :all argv << '--attribute' << attr end - if Pathname(chef.config_file).exist? + if Pathname(chef.knife_config_file).exist? with_args *argv do ::Chef::Application::Knife.new.run end else # TODO: no config file error handling end ::Chef::Knife.cuken end def node_role_load(hsh) - argv = ['node', 'run_list', 'add', hsh[:node], "role[#{hsh[:role]}]", '--no-editor', '--config', chef.config_file] - if Pathname(chef.config_file).exist? + argv = ['node', 'run_list', 'add', hsh[:node], "role[#{hsh[:role]}]", '--no-editor', '--config', chef.knife_config_file] + if Pathname(chef.knife_config_file).exist? with_args *argv do ::Chef::Application::Knife.new.run end else # TODO: no config file error handling end ::Chef::Knife.cuken end def node_create(node_name) - argv = ['node', 'create', node_name, '--no-editor', '--config', chef.config_file] - if Pathname(chef.config_file).exist? + argv = ['node', 'create', node_name, '--no-editor', '--config', chef.knife_config_file] + if Pathname(chef.knife_config_file).exist? with_args *argv do ::Chef::Application::Knife.new.run end else # TODO: no config file error handling