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

Bug: dependent cookbooks with gem dependencies and platforms filter #1016

Open
jasonwbarnett opened this issue Oct 12, 2021 · 0 comments
Open

Comments

@jasonwbarnett
Copy link
Contributor

When using the platforms constraint in a gem dependency in a metadata.rb leads to this backtrace which seems like the layer translating between metadata.rb and Gem is not handling this case.

# dependent_cookbook/metadata.rb
name 'dependent_cookbook'

# See: https://github.com/tzinfo/tzinfo/wiki/Resolving-TZInfo::DataSourceNotFound-Errors
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]
    Failure/Error: expect { chef_run }.to_not raise_error
     
       expected no Exception, got #<Gem::Requirement::BadRequirementError: Illformed requirement [{"platforms"=>["mingw", "mswin", "x64_mingw"]}]> with backtrace:
         # /opt/chef-workstation/embedded/lib/ruby/3.0.0/rubygems/requirement.rb:106:in `parse'
         # /opt/chef-workstation/embedded/lib/ruby/3.0.0/rubygems/requirement.rb:138:in `block in initialize'
         # /opt/chef-workstation/embedded/lib/ruby/3.0.0/rubygems/requirement.rb:138:in `map!'
         # /opt/chef-workstation/embedded/lib/ruby/3.0.0/rubygems/requirement.rb:138:in `initialize'
         # /opt/chef-workstation/embedded/lib/ruby/3.0.0/rubygems/requirement.rb:63:in `new'
         # /opt/chef-workstation/embedded/lib/ruby/3.0.0/rubygems/requirement.rb:63:in `create'
         # /opt/chef-workstation/embedded/lib/ruby/3.0.0/rubygems/dependency.rb:56:in `initialize'
         # /opt/chef-workstation/embedded/lib/ruby/3.0.0/rubygems/specification.rb:985:in `new'
         # /opt/chef-workstation/embedded/lib/ruby/3.0.0/rubygems/specification.rb:985:in `find_by_name'
         # /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/chefspec-9.3.1/lib/chefspec/extensions/chef/cookbook/gem_installer.rb:24:in `locate_gem'
         # /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/chefspec-9.3.1/lib/chefspec/extensions/chef/cookbook/gem_installer.rb:17:in `block in install'
         # /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/chefspec-9.3.1/lib/chefspec/extensions/chef/cookbook/gem_installer.rb:17:in `each'
         # /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/chefspec-9.3.1/lib/chefspec/extensions/chef/cookbook/gem_installer.rb:17:in `install'
         # /home/jason.barnett/.chefdk/gem/ruby/3.0.0/gems/chef-16.16.13/lib/chef/cookbook/cookbook_collection.rb:59:in `install_gems'
         # /home/jason.barnett/.chefdk/gem/ruby/3.0.0/gems/chef-16.16.13/lib/chef/policy_builder/expand_node_object.rb:94:in `setup_run_context'
         # /opt/chef-workstation/embedded/lib/ruby/3.0.0/forwardable.rb:238:in `setup_run_context'
         # /home/jason.barnett/.chefdk/gem/ruby/3.0.0/gems/chef-16.16.13/lib/chef/client.rb:496:in `setup_run_context'
         # /opt/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/chefspec-9.3.1/lib/chefspec/solo_runner.rb:113:in `converge'
         # ./spec/unit/recipes/default_spec.rb:12:in `block (2 levels) in <top (required)>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant