chef-rewind icon indicating copy to clipboard operation
chef-rewind copied to clipboard

Unwind does not remove resource attributes associated during initial declaration.

Open TonyLovesDevOps opened this issue 8 years ago • 0 comments

Tested with chef-client 12.6.0/12.14.89 and chef-rewind 0.0.9.

We're trying to use unwind to remove some notifications from a declared resource, then redefining the resource with the correct attributes. However, the redefined resource still has the old notifications.

Our code looks like:

file '/tmp/unwind_example/bar' do
  action :nothing
end

# This will break because the containing directory doesn't yet exist
directory '/tmp/unwind_example' do
  notifies :create, 'file[/tmp/unwind_example/bar]', :before
end

# Lets fix the directory resource by unwinding and redefining it with a valid notification
unwind 'directory[/tmp/unwind_example]'

directory '/tmp/unwind_example' do
  action :create
  notifies :create, "file[/tmp/unwind_example/bar]", :delayed
end

However, this code fails to converge with Parent directory /tmp/unwind_example does not exist.

Here's an example cookbook showing this behavior.

TonyLovesDevOps avatar Oct 11 '16 17:10 TonyLovesDevOps