Skip to content
This repository has been archived by the owner on Feb 14, 2020. It is now read-only.

Could you document that it is impossible rewind chef resource guard? #10

Open
bbaja42 opened this issue Jan 4, 2017 · 0 comments
Open

Comments

@bbaja42
Copy link

bbaja42 commented Jan 4, 2017

From what I see, in the resource source code, resource guards are a list, that is append only.
Since I lost a bit of time to figure it out, I thought it would be nice to extend the docs, to help other folks in future

In short, calling rewind on the guard, just adds the new guard instead of removing the exiting one.
The workaround is similar to one mentioned for the notifications, unwind the whole resource, and add a new one without the guard.

    def not_if(command=nil, opts={}, &block)
      if command || block_given?
        @not_if << Conditional.not_if(self, command, opts, &block) # APPEND ONLY LINE
      end
      @not_if
    end
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant