voxpupuli / metadata-json-lint

Tool to check the validity of Puppet metadata.json files
Apache License 2.0
29 stars 27 forks source link

Metadata-json-lint 0.0.5 + puppet-blacksmith errors #10

Closed jlambert121 closed 9 years ago

jlambert121 commented 9 years ago

Something with metadata-json-lint version 0.0.5 has broken rake when puppet-blacksmith is installed. The error is:

✗ bundle exec rake spec
rake aborted!
NameError: uninitialized constant Semantic::Dependency
/Users/jlambert/Documents/evenup/git/puppet/sensu-puppet/.bundle/vendor/gems/puppet-3.7.3/lib/puppet/forge.rb:11:in `<top (required)>'
/Users/jlambert/Documents/evenup/git/puppet/sensu-puppet/.bundle/vendor/gems/puppet-3.7.3/lib/puppet/module_tool/applications/installer.rb:6:in `require'
/Users/jlambert/Documents/evenup/git/puppet/sensu-puppet/.bundle/vendor/gems/puppet-3.7.3/lib/puppet/module_tool/applications/installer.rb:6:in `<top (required)>'
/Users/jlambert/Documents/evenup/git/puppet/sensu-puppet/.bundle/vendor/gems/puppet-3.7.3/lib/puppet/module_tool/applications.rb:8:in `require'
/Users/jlambert/Documents/evenup/git/puppet/sensu-puppet/.bundle/vendor/gems/puppet-3.7.3/lib/puppet/module_tool/applications.rb:8:in `<module:Applications>'
/Users/jlambert/Documents/evenup/git/puppet/sensu-puppet/.bundle/vendor/gems/puppet-3.7.3/lib/puppet/module_tool/applications.rb:4:in `<module:ModuleTool>'
/Users/jlambert/Documents/evenup/git/puppet/sensu-puppet/.bundle/vendor/gems/puppet-3.7.3/lib/puppet/module_tool/applications.rb:3:in `<top (required)>'
/Users/jlambert/Documents/evenup/git/puppet/sensu-puppet/.bundle/vendor/gems/puppet-3.7.3/lib/puppet/module_tool.rb:187:in `require'
/Users/jlambert/Documents/evenup/git/puppet/sensu-puppet/.bundle/vendor/gems/puppet-3.7.3/lib/puppet/module_tool.rb:187:in `<top (required)>'
/Users/jlambert/Documents/evenup/git/puppet/sensu-puppet/.bundle/vendor/gems/puppet-blacksmith-3.1.1/lib/puppet_blacksmith/modulefile.rb:13:in `require'
/Users/jlambert/Documents/evenup/git/puppet/sensu-puppet/.bundle/vendor/gems/puppet-blacksmith-3.1.1/lib/puppet_blacksmith/modulefile.rb:13:in `<top (required)>'
/Users/jlambert/Documents/evenup/git/puppet/sensu-puppet/.bundle/vendor/gems/puppet-blacksmith-3.1.1/lib/puppet_blacksmith.rb:5:in `require'
/Users/jlambert/Documents/evenup/git/puppet/sensu-puppet/.bundle/vendor/gems/puppet-blacksmith-3.1.1/lib/puppet_blacksmith.rb:5:in `<top (required)>'
/Users/jlambert/Documents/evenup/git/puppet/sensu-puppet/.bundle/vendor/gems/puppet-blacksmith-3.1.1/lib/puppet_blacksmith/rake_tasks.rb:3:in `require'
/Users/jlambert/Documents/evenup/git/puppet/sensu-puppet/.bundle/vendor/gems/puppet-blacksmith-3.1.1/lib/puppet_blacksmith/rake_tasks.rb:3:in `<top (required)>'
/Users/jlambert/Documents/evenup/git/puppet/sensu-puppet/Rakefile:5:in `require'
/Users/jlambert/Documents/evenup/git/puppet/sensu-puppet/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)

Reverting to metadata-json-lint 0.0.4 or removing puppet-blacksmith resolves the issue. maestrodev/puppet-blacksmith#14 also exists referencing this issue.

domcleal commented 9 years ago

Puppet ships its own vendored "semantic" library (https://github.com/puppetlabs/puppet/tree/master/lib/puppet/vendor/semantic) which I guess conflicts with the semantic gem used by metadata-json-lint.

jlambert121 commented 9 years ago

I saw that on the other ticket, but why does removing puppet-blacksmith then resolve the issue if that's the issue?

domcleal commented 9 years ago

puppet-blacksmith is depending on Puppet's internal module tool files (in the stack you can see it's requiring puppet/module_tool). I guess if you're only using rspec-puppet (etc) then this file might never be required.

carlossg commented 9 years ago

@domcleal is right.

If metadata-json-lint had a dependency on puppet (for the vendored semantic) instead of the semantic gem, it would work fine. Although a long term fix would be puppet releasing their vendored semantic under a new module and gem name if it is not going to be included upstream

nibalizer commented 9 years ago

Im super unwilling to make the puppet gem a dependency of metadata-json-lint. That killed puppet-librarian for me. Who can we talk to about the semantic gem at puppetlabs?

nibalizer commented 9 years ago

@electrical thoughts?

electrical commented 9 years ago

I can do some digging when i get back from Germany.

@jlambert121 can you supply the workflow to reproduce so i can test a solution?

Cheers.

jlambert121 commented 9 years ago

The way I found this was having in your Gemfile:

  gem 'metadata-json-lint',  :require => false
  gem 'puppet-blacksmith', :require => false

and in your Rakefile:

require 'puppet_blacksmith/rake_tasks'

Reverting to metadata-json-lint 0.0.4 resolves the issue.

carlossg commented 9 years ago

without involving blacksmith you can reproduce with

source "https://rubygems.org"

gem 'rake', :require => false
gem 'puppet', :require => false
gem 'metadata-json-lint',  :require => false

Rakefile

#require 'puppet/vendor/semantic/lib/semantic'
require 'puppet'
require 'puppet/module_tool'

If you add the line commented to the beginning of your Rakefile it should workaround the issue

nibalizer commented 9 years ago

So we, I think, went too far with brining in our own copy of the vendored symatic/puppetlabs library. I've reverted #9 and released 0.0.6 to the forge. That should make it possible to use metadata-json-lint without issue.

When we have a more mature implementation of dependency validation, I'll be asking you all for feedback. Thanks and sorry for breaking your shit.