Skip to content

Unwind does not remove resource attributes associated during initial declaration. #23

@TonyLovesDevOps

Description

@TonyLovesDevOps

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions