Merge branch 'pr/1267'
Conflicts: plugins/provisioners/chef/provisioner/chef_client.rb
This commit is contained in:
commit
93c98aad01
|
@ -6,6 +6,8 @@ module VagrantPlugins
|
||||||
class ChefClient < Base
|
class ChefClient < Base
|
||||||
attr_accessor :chef_server_url
|
attr_accessor :chef_server_url
|
||||||
attr_accessor :client_key_path
|
attr_accessor :client_key_path
|
||||||
|
attr_accessor :delete_client
|
||||||
|
attr_accessor :delete_node
|
||||||
attr_accessor :encrypted_data_bag_secret_key_path
|
attr_accessor :encrypted_data_bag_secret_key_path
|
||||||
attr_accessor :encrypted_data_bag_secret
|
attr_accessor :encrypted_data_bag_secret
|
||||||
attr_accessor :environment
|
attr_accessor :environment
|
||||||
|
@ -17,6 +19,8 @@ module VagrantPlugins
|
||||||
|
|
||||||
@chef_server_url = UNSET_VALUE
|
@chef_server_url = UNSET_VALUE
|
||||||
@client_key_path = UNSET_VALUE
|
@client_key_path = UNSET_VALUE
|
||||||
|
@delete_client = UNSET_VALUE
|
||||||
|
@delete_node = UNSET_VALUE
|
||||||
@encrypted_data_bag_secret_key_path = UNSET_VALUE
|
@encrypted_data_bag_secret_key_path = UNSET_VALUE
|
||||||
@encrypted_data_bag_secret = UNSET_VALUE
|
@encrypted_data_bag_secret = UNSET_VALUE
|
||||||
@environment = UNSET_VALUE
|
@environment = UNSET_VALUE
|
||||||
|
|
|
@ -97,6 +97,18 @@ module VagrantPlugins
|
||||||
def guest_validation_key_path
|
def guest_validation_key_path
|
||||||
File.join(@config.provisioning_path, "validation.pem")
|
File.join(@config.provisioning_path, "validation.pem")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def cleanup
|
||||||
|
delete_from_chef_server('client') if config.delete_client
|
||||||
|
delete_from_chef_server('node') if config.delete_node
|
||||||
|
end
|
||||||
|
|
||||||
|
def delete_from_chef_server(deletable)
|
||||||
|
node_name = (config.node_name || env[:vm].config.vm.host_name)
|
||||||
|
env[:ui].info I18n.t("vagrant.provisioners.chef.deleting_from_server",
|
||||||
|
:deletable => deletable, :name => node_name)
|
||||||
|
Kernel.system("knife #{deletable} delete --yes #{node_name} > /dev/null 2>&1")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1145,6 +1145,7 @@ en:
|
||||||
server_validation_key_doesnt_exist: |-
|
server_validation_key_doesnt_exist: |-
|
||||||
The validation key set for `config.chef.validation_key_path` does not exist! This
|
The validation key set for `config.chef.validation_key_path` does not exist! This
|
||||||
file needs to exist so it can be uploaded to the virtual machine.
|
file needs to exist so it can be uploaded to the virtual machine.
|
||||||
|
deleting_from_server: "Deleting %{deletable} \"%{name}\" from Chef server..."
|
||||||
|
|
||||||
puppet:
|
puppet:
|
||||||
not_detected: |-
|
not_detected: |-
|
||||||
|
|
Loading…
Reference in New Issue