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

Fix an "undefined method" error with rubygems >= 3.3.0 #327

Merged
merged 3 commits into from
Feb 23, 2022

Conversation

davidsansome
Copy link
Contributor

rubygems/rubygems@ae3980e changed Gem::Specification.latest_specs to return Gem::StubSpecification objects instead of Gem::Specification objects. That broke hiera-eyaml which expects the objects to have a dependencies method:

$ eyaml
Traceback (most recent call last):
	7: from /usr/local/bin/eyaml:23:in `<main>'
	6: from /usr/local/bin/eyaml:23:in `load'
	5: from /var/lib/gems/2.7.0/gems/hiera-eyaml-3.2.2/bin/eyaml:10:in `<top (required)>'
	4: from /var/lib/gems/2.7.0/gems/hiera-eyaml-3.2.2/lib/hiera/backend/eyaml/plugins.rb:31:in `find'
	3: from /var/lib/gems/2.7.0/gems/hiera-eyaml-3.2.2/lib/hiera/backend/eyaml/plugins.rb:31:in `each'
	2: from /var/lib/gems/2.7.0/gems/hiera-eyaml-3.2.2/lib/hiera/backend/eyaml/plugins.rb:34:in `block in find'
	1: from /var/lib/gems/2.7.0/gems/hiera-eyaml-3.2.2/lib/hiera/backend/eyaml/plugins.rb:34:in `each'
/var/lib/gems/2.7.0/gems/hiera-eyaml-3.2.2/lib/hiera/backend/eyaml/plugins.rb:37:in `block (2 levels) in find': undefined method `dependencies' for #<Gem::StubSpecification:0x0000559da19dd520> (NoMethodError)

lib/hiera/backend/eyaml/plugins.rb Outdated Show resolved Hide resolved
Copy link
Member

@smortex smortex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine

@smortex smortex added the bug label Feb 17, 2022
@smortex smortex self-requested a review February 17, 2022 06:54
@smortex smortex self-requested a review February 17, 2022 07:02
Copy link
Member

@smortex smortex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@davidsansome davidsansome changed the title Fix an "undefined method" error with rubygems >= 3.2.33 Fix an "undefined method" error with rubygems >= 3.3.0 Feb 17, 2022
@davidsansome
Copy link
Contributor Author

LGTM!

Thanks for the review smortex!
Any idea what else I need to do to get this merged? @bastelfreak?

@bastelfreak bastelfreak merged commit 602aaa9 into voxpupuli:master Feb 23, 2022
@robeke
Copy link

robeke commented Mar 9, 2022

I was hopeful this would resolve the issue but still unable to use with Manjaro Linux:
RubyGems Environment:

  • RUBYGEMS VERSION: 3.3.5
  • RUBY VERSION: 3.0.3 (2021-11-24 patchlevel 157) [x86_64-linux]

Result of running eyaml -h
/home/xxxxx/.local/share/gem/ruby/3.0.0/gems/hiera-eyaml-3.2.2/lib/hiera/backend/eyaml/plugins.rb:37:in `block (2 levels) in find': undefined method `dependencies' for #<Gem::StubSpecification:0x000055af4d3bd100 @extension_dir=nil, @full_gem_path=nil, @gem_dir=nil, @ignored=nil, @loaded_from="/usr/lib/ruby/gems/3.0.0/specifications/default/abbrev-0.1.0.gemspec", @data=#<Gem::StubSpecification::StubLine:0x000055af4d3bc188 @name="abbrev", @version=#<Gem::Version "0.1.0">, @platform="ruby", @extensions=[], @full_name="abbrev-0.1.0", @require_paths=["lib"]>, @name=nil, @spec=nil, @base_dir="/usr/lib/ruby/gems/3.0.0", @gems_dir="/usr/lib/ruby/gems/3.0.0/gems", @default_gem=true> (NoMethodError) from /home/xxxxx/.local/share/gem/ruby/3.0.0/gems/hiera-eyaml-3.2.2/lib/hiera/backend/eyaml/plugins.rb:34:in `each' from /home/xxxxx/.local/share/gem/ruby/3.0.0/gems/hiera-eyaml-3.2.2/lib/hiera/backend/eyaml/plugins.rb:34:in `block in find' from /home/xxxxx/.local/share/gem/ruby/3.0.0/gems/hiera-eyaml-3.2.2/lib/hiera/backend/eyaml/plugins.rb:31:in `each' from /home/xxxxx/.local/share/gem/ruby/3.0.0/gems/hiera-eyaml-3.2.2/lib/hiera/backend/eyaml/plugins.rb:31:in `find' from /home/xxxxx/.local/share/gem/ruby/3.0.0/gems/hiera-eyaml-3.2.2/bin/eyaml:10:in `<top (required)>' from /home/xxxxx/.local/share/gem/ruby/3.0.0/bin/eyaml:25:in `load' from /home/xxxxx/.local/share/gem/ruby/3.0.0/bin/eyaml:25:in `<main>'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants