Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental lazy resource block mode #8500

Open
lamont-granquist opened this issue May 8, 2019 · 2 comments

Comments

Projects
None yet
1 participant
@lamont-granquist
Copy link
Contributor

commented May 8, 2019

Instead of instance_exec'ing the block for a resource when it is parsed in the DSL, hang the block off of the resource. When it comes time to execute an action, apply the block (and set the block to nil so it never gets reapplied). That would have the effect of lazying the entire
block, including raw ruby code inside the block, all the properties, not_if with string arguments, etc. Vastly less hacky than having lazy {} sprinkled all over code and dealing with the endless pile of DelayedEvaluator bugs (and we can't fix those bugs in external cookbooks via any changes in core chef, lazy {} is just a whack-a-mole bug generator).

Flag this so it is experimental and opt-in with different scopes:

  • opt-in at the custom resource level
  • opt-in at the recipe level
  • opt-in at the Chef::Config entire-chef-run level

Also have the flag be usable as an opt-out should the default Chef::Config value ever get tweaked.

@lamont-granquist

This comment has been minimized.

Copy link
Contributor Author

commented May 8, 2019

And I'd prefer to nuke compile/converge from orbit, but I've never come up with a solution that does away with the compile/converge phase for the outer recipe scope without being overly disruptive to the way that everyone has designed their accumulators, so I don't see that ever completely going away, even if we ever turned off compile/converge mode for custom resources. So I think we'd want this anyway.

@lamont-granquist

This comment has been minimized.

Copy link
Contributor Author

commented May 8, 2019

This is also morally equivalent to the request of "automatically lazy all the properties", but does it way cleaner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.