What this post is about This post is intended for folks who are comfortable with the basics of attributes in Chef, but want to understand some of the subtleties better. It focusses on one specific …

Does anyone know if there is development work from Opscode currently ongoing to make the wrapper development method a functional methodology?

Is there a facility / is there work currently under development to support env attributes in a role cookbook? That way you could properly test changes in a staged C/I workflow without instantly promoting changes to production.

Making wrappers is fine, you just need to be cognizant of the code you are writing. There is no general fix for this problem because it’s a fundamental issue of code ordering. As for attribute promotion, you might want to check out Policyfiles and poise-hoist for that workflow.

I understand and am sympathetic to your viewpoint, but what do you think most users will make of code that renders different outputs from one run to the next? Isn’t idempotency supposed to be a pillar of the Chef development model?

Regarding PolicyFIles, do you know they fit into the development roadmap for OpsCode? A year ago, a coworker of mine told me that they are the future of development for Chef, but last week at the AWS Summit, an OpsCode representative told him to forget that he ever knew they existed.

but all you really should do is just set this properly… even if you ‘repeat’ your values somewhat…
node.default[‘namespace’][‘ultimate_value’]

its really a niche thing to have issues with… most folks wont ever run into it… if you’re not that deep into things yet… you’ll see most things will fit quite nicely… its only when taking short cuts that things behave oddly

The issue is that I have no control over the upstream cookbook. I want to maintain upstream compatibility, but overriding every derived attribute in a wrapper makes my wrapper super fragile. In your example, often those intermediate values are used for an assortment of computed objects.

When you say “use a code block” do you mean reopen the compiled object in Ruby? Because then you are still dependent on particular variable names and structures implemented in the wrapped cookbook. That makes my codebase no more robust.

If I had to guess, I would imagine that the majority of Chef users probably fork and run local codebases, but I’ll defer to you.

For the record, this isn’t about taking shortcuts, it’s about building something reliable and easy to maintain, from my perspective
Joseph Hammerman

All you have described is standard practice though. Depend on upstream cookbook and set the appropriate attributes to define the default behavior in the wrapper.

Do you have any examples of where you have had actual issues ?

Lots of wrapper cookbooks sometimes work by just setting a few default attributes… other can tie multiple upstream cookbooks and invoke as needed… I’ve never encountered an attribute issue that couldn’t be solved in a trivial manner.