-
Notifications
You must be signed in to change notification settings - Fork 168
chef provision -d option does not work as expected #618
Comments
Thought I would also add :
|
What documentation are you following? |
I'm looking at the documentation for "chef provision" : https://docs.chef.io/ctl_chef.html#chef-provision There is a NOTE: that mentions context but I was not using the option. I tried what you mention and everything works - which is great !! Thanks you !! But also begs the question - What documentation are you following ? My background is Ops and Bash. I still get lost in ruby and objects. I did try going through the chef-dk code. And MANY Thanks for the quick response !! |
I wrote context = ChefDK::ProvisioningData.context
# Set the port dynamically via the command line:
target_port = context.opts.port
with_driver 'vagrant:~/.vagrant.d/boxes' do
options = {
vagrant_options: {
'vm.box' => 'opscode-ubuntu-14.04',
'vm.network' => ":forwarded_port, guest: 80, host: #{target_port}"
},
convergence_options: context.convergence_options
}
machine context.node_name do
machine_options(options)
# This forces a chef run every time, which is sensible for `chef provision`
# use cases.
converge(true)
action(context.action)
end
end Anyway, I'll notify the documentation team about this and see if I can get an improved example included on the page you linked. |
I've filed this bug in the chef-docs issues, so I am closing this one. |
I have been ignoring policyfiles for now - and this is probably why I missed the above blog entry (or glanced over it quickly). No time like the present though !! Thanks again. |
I have this problem both with vagrant and vsphere.
I have the following machine definition in
provision\recipes\sparkler_create.rb
:When running it as :
chef provision --no-policy --recipe sparkler_create
All goes well - the machine is created in VSpere as expected. From the documentation, I expect to be able to run :
chef provision --d --no-policy --recipe sparkler_create
And have it get destroyed and yet it does not and reruns action :install.
All works well if I add the
action :destroy
in the cookbook (I actually have asparkler_destroy
)The text was updated successfully, but these errors were encountered: