voxpupuli / puppet-blacksmith

Ruby Gem with Puppet Module utilities
Apache License 2.0
69 stars 31 forks source link

Puppet 3.7.3 and puppet-blacksmith 3.1.1 error #14

Closed benhocker closed 8 years ago

benhocker commented 9 years ago

I'm getting the following after updating to puppet 3.7.3 and puppet-blacksmith 3.1.1:

→ rake spec --trace
rake aborted!
NameError: uninitialized constant Semantic::Dependency
/home/ben/.rvm/gems/ruby-2.1.5@puppet/gems/puppet-3.7.3/lib/puppet/forge.rb:11:in `'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/gems/puppet-3.7.3/lib/puppet/module_tool/applications/installer.rb:6:in `require'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/gems/puppet-3.7.3/lib/puppet/module_tool/applications/installer.rb:6:in `'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/gems/puppet-3.7.3/lib/puppet/module_tool/applications.rb:8:in `require'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/gems/puppet-3.7.3/lib/puppet/module_tool/applications.rb:8:in `'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/gems/puppet-3.7.3/lib/puppet/module_tool/applications.rb:4:in `'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/gems/puppet-3.7.3/lib/puppet/module_tool/applications.rb:3:in `'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/gems/puppet-3.7.3/lib/puppet/module_tool.rb:187:in `require'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/gems/puppet-3.7.3/lib/puppet/module_tool.rb:187:in `'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/gems/puppet-blacksmith-3.1.1/lib/puppet_blacksmith/modulefile.rb:13:in `require'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/gems/puppet-blacksmith-3.1.1/lib/puppet_blacksmith/modulefile.rb:13:in `'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/gems/puppet-blacksmith-3.1.1/lib/puppet_blacksmith.rb:5:in `require'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/gems/puppet-blacksmith-3.1.1/lib/puppet_blacksmith.rb:5:in `'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/gems/puppet-blacksmith-3.1.1/lib/puppet_blacksmith/rake_tasks.rb:3:in `require'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/gems/puppet-blacksmith-3.1.1/lib/puppet_blacksmith/rake_tasks.rb:3:in `'
/home/ben/src/r10k_devel/oracle_app_server/Rakefile:11:in `require'
/home/ben/src/r10k_devel/oracle_app_server/Rakefile:11:in `'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/gems/rake-10.4.2/lib/rake/rake_module.rb:28:in `load'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/gems/rake-10.4.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/gems/rake-10.4.2/lib/rake/application.rb:689:in `raw_load_rakefile'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/gems/rake-10.4.2/lib/rake/application.rb:94:in `block in load_rakefile'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/gems/rake-10.4.2/lib/rake/application.rb:93:in `load_rakefile'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/gems/rake-10.4.2/lib/rake/application.rb:77:in `block in run'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/gems/rake-10.4.2/bin/rake:33:in `'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/bin/rake:23:in `load'
/home/ben/.rvm/gems/ruby-2.1.5@puppet/bin/rake:23:in `
' /home/ben/.rvm/gems/ruby-2.1.5@puppet/bin/ruby_executable_hooks:15:in `eval' /home/ben/.rvm/gems/ruby-2.1.5@puppet/bin/ruby_executable_hooks:15:in `
'

Below is my Gemfile:

source "https://rubygems.org"

group :test do
  gem "metadata-json-lint"
  gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.7.0'
  gem "puppetlabs_spec_helper"
  gem "rake"
  gem "rspec-puppet", :git => 'https://github.com/rodjek/rspec-puppet.git'
end

group :development do
  gem "puppet-blacksmith"
  gem "guard-rake"
end

Below is a gem list:

*** LOCAL GEMS ***

bigdecimal (1.2.4)
bundler (1.7.6)
bundler-unload (1.0.2)
celluloid (0.16.0)
CFPropertyList (2.2.8)
coderay (1.1.0)
diff-lcs (1.2.5)
executable-hooks (1.3.2)
facter (2.3.0)
ffi (1.9.6)
formatador (0.2.5)
gem-wrappers (1.2.7)
guard (2.11.1)
guard-rake (1.0.0)
hiera (1.3.4)
hitimes (1.2.2)
io-console (0.4.2)
json (1.8.2, 1.8.1)
json_pure (1.8.2)
listen (2.8.5)
lumberjack (1.0.9)
metaclass (0.0.4)
metadata-json-lint (0.0.5)
method_source (0.8.2)
mime-types (2.4.3)
minitest (4.7.5)
mocha (1.1.0)
nenv (0.1.1)
netrc (0.10.2)
notiffany (0.0.3)
pry (0.10.1)
psych (2.0.5)
puppet (3.7.3)
puppet-blacksmith (3.1.1)
puppet-lint (1.1.0)
puppet-syntax (1.4.1)
puppetlabs_spec_helper (0.8.2)
rake (10.4.2, 10.1.0)
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
rdoc (4.1.0)
rest-client (1.7.2)
rspec (2.99.0)
rspec-core (2.99.2)
rspec-expectations (2.99.2)
rspec-mocks (2.99.2)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
semantic (1.3.1)
shellany (0.0.1)
slop (3.6.0)
spdx-licenses (1.0.0)
test-unit (2.1.5.0)
thor (0.19.1)
timers (4.0.1)
carlossg commented 9 years ago

working here and tests are passing https://travis-ci.org/maestrodev/puppet-blacksmith/jobs/42844197

thejandroman commented 9 years ago

Getting the same error on ruby-2.1.0, ruby-2.1.1, and ruby-2.1.5.

carlossg commented 9 years ago

The problem is with metadata-json-lint. It has a dependency in the semantic gem, while Puppet includes it vendored. I guess they are different versions. Removing metadata-json-lint from Gemfile it works correctly

jlambert121 commented 9 years ago

Running metadata-json-lint 0.0.5 and puppet-blacksmith 3.1.1 causes this error for me, removing puppet-blacksmith or metadata-json-lint resolves this error (puppet 3.7.3). Is this an incompatibility between these two projects rather than metadata-json-lint with puppet?

carlossg commented 9 years ago

no, this is a problem between metadata-json-lint and puppet. blacksmith just happens to require puppet for some tools, and that's why the error happens

jlambert121 commented 9 years ago

@carlossg thanks for the explanation, that makes sense.

carlossg commented 9 years ago

Try adding require 'puppet/vendor/semantic/lib/semantic' to the beginning of your Rakefile, or before any puppet references

benhocker commented 9 years ago

That does seem to work with metadata-json-lint 0.0.5. Is that the recommended solution?

carlossg commented 9 years ago

This fixes it for me with latest gems

Gemfile

source "https://rubygems.org"

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

Rakefile:

require 'puppet/vendor/semantic/lib/semantic'
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet_blacksmith/rake_tasks'
bundle exec rake
dfarrell07 commented 9 years ago

Try adding require 'puppet/vendor/semantic/lib/semantic' to the beginning of your Rakefile, or before any puppet references

First: This is very helpful, thank you.

However, note that adding this line seems to break Puppet versions <= 3.5.

LoadError: cannot load such file -- puppet/vendor/semantic/lib/semantic
carlossg commented 9 years ago

You can do

require 'puppet/version'
require 'puppet/vendor/semantic/lib/semantic' unless Puppet.version.to_f <3.6
jyaworski commented 8 years ago

Hello. This looks like it's been resolved. Please re-open if it hasn't been resolved.