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

Deprecation warning that needs to be a failure (since it fails) #158

Closed
iennae opened this issue Apr 20, 2017 · 3 comments
Closed

Deprecation warning that needs to be a failure (since it fails) #158

iennae opened this issue Apr 20, 2017 · 3 comments
Assignees
Labels
Type: Bug Does not work as expected.

Comments

@iennae
Copy link
Contributor

iennae commented Apr 20, 2017

Cookbook version

     - chef-ingredient (2.0.4)

Chef-client version

   Starting Chef Client, version 13.0.118

Platform Details

centos 7.3

Scenario:

getting conflicting information about what to use in a recipe "dk" versus "chefdk" The fix is to just update the warning to be to recommend using chefdk versus recommending using dk.

Steps to Reproduce:

In a recipe use

chef_ingredient "chef-dk" do
action :install
version :latest
end

It will have a deprecation warning and then a failure about dk being invalid. I need to dig more into where this is coming from, but wanted to note the issue. (I'm in the process of setting up my replacement laptop so I don't want to lose the information and forget about this issue in the process.

Expected Result:

Successful converge with potential deprecation warning.

Actual Result:

* chef_ingredient[chef-dk] action install[2017-04-20T02:52:22+00:00] WARN: product_name 'chef-dk' is deprecated and it will be removed in the future versions of chef-ingredient. Use 'dk' instead of 'chef-dk'. [2017-04-20T02:52:22+00:00] WARN: product_name 'chef-dk' is deprecated and it will be removed in the future versions of chef-ingredient. Use 'dk' instead of 'chef-dk'.
     Recipe: <Dynamically Defined Resource>
       * chef_gem[mixlib-install] action install
         - install version ~> 3.2 of package mixlib-install

       ================================================================================
       Error executing action `install` on resource 'chef_ingredient[chef-dk]'
       ================================================================================

       Mixlib::Install::Options::InvalidOptions
       ----------------------------------------
       Unknown product name dk.
       Must be one of: analytics, angry-omnibus-toolchain, angrychef, automate, chef, chef-backend, chef-server, chef-server-ha-provisioning, chefdk, compliance, delivery, ha, harmony, inspec, manage, marketplace, omnibus-toolchain, private-chef, push-jobs-client, push-jobs-server, reporting, supermarket, sync

       Cookbook Trace:
       ---------------
       /tmp/kitchen/cache/cookbooks/chef-ingredient/libraries/helpers.rb:298:in `new'
       /tmp/kitchen/cache/cookbooks/chef-ingredient/libraries/helpers.rb:298:in `installer'
       /tmp/kitchen/cache/cookbooks/chef-ingredient/libraries/default_handler.rb:96:in `configure_from_channel'
       /tmp/kitchen/cache/cookbooks/chef-ingredient/libraries/default_handler.rb:46:in `configure_package'
       /tmp/kitchen/cache/cookbooks/chef-ingredient/libraries/default_handler.rb:23:in `handle_install'
       /tmp/kitchen/cache/cookbooks/chef-ingredient/resources/chef_ingredient.rb:59:in `block in class_from_file'

       Resource Declaration:
       ---------------------
       # In /tmp/kitchen/cache/cookbooks/linux-desktop/recipes/default.rb

         7: chef_ingredient "chef-dk" do
         8:   action :install
         9:   version :latest
        10: end

       Compiled Resource:
       ------------------
       # Declared in /tmp/kitchen/cache/cookbooks/linux-desktop/recipes/default.rb:7:in `from_file'

       chef_ingredient("chef-dk") do
         action [:install]
         default_guard_interpreter :default
         declared_type :chef_ingredient
         cookbook_name "linux-desktop"
         recipe_name "default"
         version :latest
         product_name "dk"
       end

       System Info:
       ------------
       chef_version=13.0.118
       platform=centos
       platform_version=7.3.1611
       ruby=ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
       program_name=chef-client worker: ppid=13469;start=02:51:59;
       executable=/opt/chef/bin/chef-client


   Running handlers:
   [2017-04-20T02:58:43+00:00] ERROR: Running exception handlers
   [2017-04-20T02:58:43+00:00] ERROR: Running exception handlers
   Running handlers complete
   [2017-04-20T02:58:43+00:00] ERROR: Exception handlers complete
   [2017-04-20T02:58:43+00:00] ERROR: Exception handlers complete
   Chef Client failed. 1 resources updated in 06 minutes 43 seconds
   [2017-04-20T02:58:43+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
   [2017-04-20T02:58:43+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
   [2017-04-20T02:58:43+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
   [2017-04-20T02:58:43+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
   [2017-04-20T02:58:43+00:00] ERROR: chef_ingredient[chef-dk] (linux-desktop::default line 7) had an error: Mixlib::Install::Options::InvalidOptions: Unknown product name dk.
   Must be one of: analytics, angry-omnibus-toolchain, angrychef, automate, chef, chef-backend, chef-server, chef-server-ha-provisioning, chefdk, compliance, delivery, ha, harmony, inspec, manage, marketplace, omnibus-toolchain, private-chef, push-jobs-client, push-jobs-server, reporting, supermarket, sync

   [2017-04-20T02:58:43+00:00] ERROR: chef_ingredient[chef-dk] (linux-desktop::default line 7) had an error: Mixlib::Install::Options::InvalidOptions: Unknown product name dk.
   Must be one of: analytics, angry-omnibus-toolchain, angrychef, automate, chef, chef-backend, chef-server, chef-server-ha-provisioning, chefdk, compliance, delivery, ha, harmony, inspec, manage, marketplace, omnibus-toolchain, private-chef, push-jobs-client, push-jobs-server, reporting, supermarket, sync

   [2017-04-20T02:58:43+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
   [2017-04-20T02:58:43+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

------Exception-------
Class: Kitchen::ActionFailed
Message: 1 actions failed.
Converge failed on instance . Please see .kitchen/logs/default-centos-73.log for more details

Please see .kitchen/logs/kitchen.log for more details
Also try running kitchen diagnose --all for configuration

@iennae
Copy link
Contributor Author

iennae commented Apr 20, 2017

This looks like it's not specifically encoded for chef-dk, it just manages to match this:

if !%w(chef-backend chef-server chef-server-ha-provisioning).include?(new_resource.product_name) &&

I'm not sure if the fix would be to add a check for dk or not. At minimum having an example of using it in the README might be useful as that's the first place I looked. I'm happy to submit a PR based on the feels here for a doc update.

@wrightp
Copy link

wrightp commented Apr 20, 2017

This bug is that the matcher is greedily catching the invalid product name "chef-dk".

(match = new_resource.product_name.match(/(chef-|opscode-)(?<product_key>.*)/))

The mixlib-install error is doing it's job informing that "chef-dk" is not a valid product and it provides the valid products. Use "chefdk".

The deprecation warning should not be executing which is causing the extra confusion.

@wrightp wrightp self-assigned this Apr 20, 2017
@wrightp wrightp added the Type: Bug Does not work as expected. label Apr 20, 2017
@wrightp
Copy link

wrightp commented Apr 20, 2017

fix available in next release

@wrightp wrightp closed this as completed Apr 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Does not work as expected.
Projects
None yet
Development

No branches or pull requests

2 participants