Added support for env.config.chef.node_name when using ChefServer.
This commit is contained in:
parent
de4442fc77
commit
d87030a798
|
@ -11,6 +11,7 @@ module Vagrant
|
|||
attr_accessor :validation_key_path
|
||||
attr_accessor :validation_client_name
|
||||
attr_accessor :client_key_path
|
||||
attr_accessor :node_name
|
||||
|
||||
# Chef solo specific config
|
||||
attr_accessor :cookbooks_path
|
||||
|
@ -22,6 +23,7 @@ module Vagrant
|
|||
def initialize
|
||||
@validation_client_name = "chef-validator"
|
||||
@client_key_path = "/etc/chef/client.pem"
|
||||
@node_name = "client"
|
||||
|
||||
@cookbooks_path = "cookbooks"
|
||||
@provisioning_path = "/tmp/vagrant-chef"
|
||||
|
|
|
@ -64,7 +64,7 @@ solo
|
|||
def run_chef_client
|
||||
logger.info "Running chef-client..."
|
||||
env.ssh.execute do |ssh|
|
||||
ssh.exec!("cd #{env.config.chef.provisioning_path} && sudo chef-client -c client.rb -j dna.json") do |channel, data, stream|
|
||||
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|
|
||||
# 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
|
||||
logger.info("#{stream}: #{data}")
|
||||
|
|
|
@ -51,6 +51,7 @@ class Test::Unit::TestCase
|
|||
config.chef.chef_server_url = "http://localhost:4000"
|
||||
config.chef.validation_key_path = "validation.pem"
|
||||
config.chef.client_key_path = "/zoo/foo/bar.pem"
|
||||
config.chef.node_name = "baz"
|
||||
config.chef.cookbooks_path = "cookbooks"
|
||||
config.chef.provisioning_path = "/tmp/vagrant-chef"
|
||||
config.chef.json = {
|
||||
|
|
|
@ -179,7 +179,7 @@ config
|
|||
context "running chef client" do
|
||||
should "cd into the provisioning directory and run chef client" do
|
||||
ssh = mock("ssh")
|
||||
ssh.expects(:exec!).with("cd #{@env.config.chef.provisioning_path} && sudo chef-client -c client.rb -j dna.json").once
|
||||
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
|
||||
@env.ssh.expects(:execute).yields(ssh)
|
||||
@action.run_chef_client
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue