chef-boneyard / push-jobs-cookbook

Development repository for Chef Cookbook push-jobs
https://supermarket.chef.io/cookbooks/push-jobs
Apache License 2.0
21 stars 43 forks source link

Resource cloning #135

Closed zepheiryan closed 6 years ago

zepheiryan commented 6 years ago

Cookbook version

v5.1.2

Chef-client version

v12.21.26

Platform Details

Scenario:

We're preparing to make the move to Chef 13 by eliminating sources of the resource cloning warning message. We've gotten rid of all of our own self-inflicted cloning instances, and now the only two left come from this cookbook colliding with the chef-client cookbook as they battle over /etc/chef and /var/log/chef.

Additionally, the repeated use of the same resource name for all services in resources/service_systemd.rb appears to set off resource cloning warnings, too, as seen in #134.

Steps to Reproduce:

Include chef-client::config, chef-client::service, and push-jobs::default in a node's run list:

$ chef-client -o 'recipe[chef-client::config],recipe[chef-client::service],recipe[push-jobs::default]'

There is a newer release of chef-client, but the helpers.rb file has not changed in this regard.

Expected Result:

No resource cloning warnings.

Actual Result:

From our logs, every day:

[2017-12-11T03:02:57+00:00] WARN: Cloning resource attributes for directory[/etc/chef] from prior resource
Previous directory[/etc/chef]: /var/chef/cache/cookbooks/chef-client/libraries/helpers.rb:56:in `rescue in block in create_chef_directories'
Current  directory[/etc/chef]: /var/chef/cache/cookbooks/push-jobs/recipes/config.rb:24:in `from_file' (CHEF-3694)/var/chef/cache/cookbooks/poise/files/halite_gem/poise/helpers/resource_cloning.rb:58:in `emit_cloned_resource_warning'.
Please see https://docs.chef.io/deprecations_resource_cloning.html for further details and information on how to correct this problem. at /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.21.26/lib/chef/event_dispatch/dispatcher.rb:43:in `call'
[2017-12-11T03:02:57+00:00] WARN: Cloning resource attributes for directory[/var/log/chef] from prior resource
Previous directory[/var/log/chef]: /var/chef/cache/cookbooks/chef-client/libraries/helpers.rb:56:in `rescue in block in create_chef_directories'
Current  directory[/var/log/chef]: /var/chef/cache/cookbooks/push-jobs/recipes/config.rb:33:in `from_file' (CHEF-3694)/var/chef/cache/cookbooks/poise/files/halite_gem/poise/helpers/resource_cloning.rb:58:in `emit_cloned_resource_warning'.
Please see https://docs.chef.io/deprecations_resource_cloning.html for further details and information on how to correct this problem. at /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.21.26/lib/chef/event_dispatch/dispatcher.rb:43:in `call'

Additional output excerpt from that chef-client -o run (same as #134):

  Cloning resource attributes for service[chef-push-jobs-client] from prior resource
Previous service[chef-push-jobs-client]: /var/chef/cache/cookbooks/push-jobs/resources/service_systemd.rb:85:in `create_init'
Current  service[chef-push-jobs-client]: /var/chef/cache/cookbooks/push-jobs/resources/service_systemd.rb:72:in `block in class_from_file' at 1 location:
    - /var/chef/cache/cookbooks/push-jobs/resources/service_systemd.rb:72:in `block in class_from_file'
   See https://docs.chef.io/deprecations_resource_cloning.html for further details.
  Cloning resource attributes for service[chef-push-jobs-client] from prior resource
Previous service[chef-push-jobs-client]: /var/chef/cache/cookbooks/push-jobs/resources/service_systemd.rb:85:in `create_init'
Current  service[chef-push-jobs-client]: /var/chef/cache/cookbooks/push-jobs/resources/service_systemd.rb:39:in `block in class_from_file' at 1 location:
    - /var/chef/cache/cookbooks/push-jobs/resources/service_systemd.rb:39:in `block in class_from_file'
   See https://docs.chef.io/deprecations_resource_cloning.html for further details.
tas50 commented 6 years ago

This warning isn't actually an issue the way that resource cloning is being done. Resource cloning is a tough deprecation warning because a good chunk of the time it warns, but the cloning won't cause failures in Chef 13. This cookbook does work in 13/14 without issues.