Skip to content

Update ohai cookbook for namespace deprecation #30

@ccrebolder

Description

@ccrebolder

Cookbook Version

3.2.1 and master

Chef Client Version

The deprecation notice is visible in chef-client 13 and applies to upcoming chef-client 14.

Platform Details

Applies to all platforms

Scenario

I've been doing an inventory and clean up of the various Chef 14 deprecations in our environment. This one is actually coming from the dependent ohai cookbook and is fixed in the later (~> 5.0) versions.

I was going to submit quick PR with the version bump but then realized that this version of ohai is dependent on chef >= 12.7 and so would be a breaking change for anyone on chef-client versions 12.0-12.6. Not sure how you'd like to handle that.

Steps to Reproduce

in .kitchen.yml:

provisioner:
  name: chef_zero
  require_chef_omnibus: 13
  data_bags_path: ./test/data_bags
  client_rb:
    treat_deprecation_warnings_as_errors: true # WiP on some depends

and converge any suite.

Expected Result

converges successfully

Actual Result

           ================================================================================
           Error executing action `create` on resource 'ohai_plugin[dovecot]'
           ================================================================================
           
           Chef::Exceptions::DeprecatedFeatureError
           ----------------------------------------
           "rename path to new_resource.path (CHEF-19)/tmp/kitchen/cache/cookbooks/ohai/resources/plugin.rb:13:in `desired_plugin_path'.\nPlease see https://docs.chef.io/deprecations_namespace_collisions.html for further details and information on how to correct this proble
m. at /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/formatters/doc.rb:419:in `deprecation'"
           
           Cookbook Trace:
           ---------------
           /tmp/kitchen/cache/cookbooks/ohai/resources/plugin.rb:13:in `desired_plugin_path'
           /tmp/kitchen/cache/cookbooks/ohai/resources/plugin.rb:80:in `block in class_from_file'
           /tmp/kitchen/cache/cookbooks/ohai/resources/plugin.rb:131:in `block in after_created'
           /tmp/kitchen/cache/cookbooks/ohai/resources/plugin.rb:130:in `each'
           /tmp/kitchen/cache/cookbooks/ohai/resources/plugin.rb:130:in `after_created'
           /tmp/kitchen/cache/cookbooks/dovecot/recipes/ohai_plugin.rb:34:in `from_file'
           /tmp/kitchen/cache/cookbooks/dovecot/recipes/default.rb:22:in `from_file'
           /tmp/kitchen/cache/cookbooks/dovecot_test/recipes/default.rb:22:in `from_file'
           
           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cache/cookbooks/dovecot/recipes/ohai_plugin.rb
           
            34: ohai_plugin 'dovecot' do
            35:   name 'dovecot'
            36:   source_file "#{source_dir}/dovecot.rb.erb"
            37:   resource :template
            38:   variables enable_build_options: ohai_build_options
            39: end
           
           Compiled Resource:
           ------------------
           # Declared in /tmp/kitchen/cache/cookbooks/dovecot/recipes/ohai_plugin.rb:34:in `from_file'
           
           ohai_plugin("dovecot") do
             action [:create]
             default_guard_interpreter :default
             declared_type :ohai_plugin
             cookbook_name "dovecot"
             recipe_name "ohai_plugin"
             source_file "ohai7_plugins/dovecot.rb.erb"
             resource :template
             variables {:enable_build_options=>true}
             plugin_name "dovecot"
           end
           
           System Info:
           ------------
           chef_version=13.8.5
           platform=ubuntu
           platform_version=16.04
           ruby=ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-linux]
           program_name=chef-client worker: ppid=1720;start=15:49:35;
           executable=/opt/chef/bin/chef-client

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions