Moved node_name from command option on chef-client to the generated config file.

This commit is contained in:
Adrian Bravo 2010-04-01 14:24:25 -07:00 committed by Mitchell Hashimoto
parent d87030a798
commit ed3e86d20f
2 changed files with 4 additions and 2 deletions

View File

@ -42,6 +42,7 @@ module Vagrant
solo_file = <<-solo solo_file = <<-solo
log_level :info log_level :info
log_location STDOUT log_location STDOUT
node_name "#{env.config.chef.node_name}"
ssl_verify_mode :verify_none ssl_verify_mode :verify_none
chef_server_url "#{env.config.chef.chef_server_url}" chef_server_url "#{env.config.chef.chef_server_url}"
@ -64,7 +65,7 @@ solo
def run_chef_client def run_chef_client
logger.info "Running chef-client..." logger.info "Running chef-client..."
env.ssh.execute do |ssh| env.ssh.execute do |ssh|
ssh.exec!("cd #{env.config.chef.provisioning_path} && sudo chef-client -c client.rb -j dna.json -N #{env.config.chef.node_name}") do |channel, data, stream| ssh.exec!("cd #{env.config.chef.provisioning_path} && sudo chef-client -c client.rb -j dna.json") do |channel, data, stream|
# TODO: Very verbose. It would be easier to save the data and only show it during # TODO: Very verbose. It would be easier to save the data and only show it during
# an error, or when verbosity level is set high # an error, or when verbosity level is set high
logger.info("#{stream}: #{data}") logger.info("#{stream}: #{data}")

View File

@ -149,6 +149,7 @@ class ChefServerProvisionerTest < Test::Unit::TestCase
expected_config = <<-config expected_config = <<-config
log_level :info log_level :info
log_location STDOUT log_location STDOUT
node_name "#{@env.config.chef.node_name}"
ssl_verify_mode :verify_none ssl_verify_mode :verify_none
chef_server_url "#{@env.config.chef.chef_server_url}" chef_server_url "#{@env.config.chef.chef_server_url}"
@ -179,7 +180,7 @@ config
context "running chef client" do context "running chef client" do
should "cd into the provisioning directory and run chef client" do should "cd into the provisioning directory and run chef client" do
ssh = mock("ssh") ssh = mock("ssh")
ssh.expects(:exec!).with("cd #{@env.config.chef.provisioning_path} && sudo chef-client -c client.rb -j dna.json -N #{@env.config.chef.node_name}").once ssh.expects(:exec!).with("cd #{@env.config.chef.provisioning_path} && sudo chef-client -c client.rb -j dna.json").once
@env.ssh.expects(:execute).yields(ssh) @env.ssh.expects(:execute).yields(ssh)
@action.run_chef_client @action.run_chef_client
end end