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

Enablement of `unified_mode` for v17+ Chef client compatibility

Open ChefAustin opened this issue 4 years ago • 1 comments

Describe the Enhancement:

Converging the cookbooks in this repo on a v17+ Chef client result in the following deprecation warning being thrown at the end of the run (using fb_systemd as an example):

  The  resource in the fb_systemd cookbook should declare `unified_mode true` at 2 locations:
    - /var/chef/cache/cookbooks/fb_systemd/resources/loader_entries.rb
    - /var/chef/cache/cookbooks/fb_systemd/resources/reload.rb
   See https://docs.chef.io/deprecations_unified_mode/ for further details.

See: https://docs.chef.io/unified_mode/

Describe the Need:

Anyone using Chef client v17+ will face this deprecation warning until unified_mode true is appended to the first line of each custom resource file.

Current Alternative

Ignore the deprecation warning.

Can We Help You Implement This?:

Should be a relatively easy PR (or series of PR's) to craft.

ChefAustin avatar Oct 01 '21 08:10 ChefAustin

We will likely need to set it to false for our more complicated resources in the short-term. Especially fb_networking_scripts is super complicated and does a lot of trickery (that is probably easier in unified mode, but will require work).

jaymzh avatar Oct 01 '21 17:10 jaymzh

Per @jaymzh's earlier comment:

We will likely need to set it to false for our more complicated resources in the short-term.

That's what I've ended up doing in 56b5304, and I'll be going through the resources in the coming weeks to ratchet those resources to unified_mode true (though happy to review PRs that beat me to it :-)

dafyddcrosby avatar Aug 18 '23 20:08 dafyddcrosby

Bravo! Thank you!

taylorific avatar Aug 20 '23 16:08 taylorific

Thank you very much for landing this! I've been testing these cookbooks against Chef 18 for a few weeks now in our fleet. The only real issue I've discovered so far is that there's some weird issue around notifications with the networking resources (as @jaymzh pointed out). As a workaround, I just did the following in our version of fb_init. Though we haven't exhaustively tested every cookbook in chef-cookbooks. Will test again now with this unified_mode true changes rolled in without deleting the fb_helpers_gated_template resource, to see if it works any better.

if node.systemd?
  include_recipe 'fb_systemd'
  # Don't allow management of /etc/systemd/networkd.conf - has weird
  # issues with notifications
  delete_resource(:fb_helpers_gated_template, '/etc/systemd/networkd.conf')
  include_recipe 'fb_timers'
end

taylorific avatar Aug 20 '23 16:08 taylorific