Ruby bundler安装不需要的puppet gem版本

Ruby bundler安装不需要的puppet gem版本,ruby,rspec,puppet,Ruby,Rspec,Puppet,我有以下脚本 PUPPET_VERSION=3.7.4 ruby='1.8.7-p374' rvm use $ruby@$$ --create gem install bundler bundle install --gemfile=.gemfile 这已经奏效几个月了,但不幸的是现在它已经决定停止工作 在此脚本之后,将调用rake来运行一些rspec任务 在centos 6.6测试运行程序上,该过程失败。 在centos 6.4开发机器上,它仍然可以工作 source 'https://r

我有以下脚本

PUPPET_VERSION=3.7.4
ruby='1.8.7-p374'

rvm use $ruby@$$ --create
gem install bundler
bundle install --gemfile=.gemfile
这已经奏效几个月了,但不幸的是现在它已经决定停止工作

在此脚本之后,将调用rake来运行一些rspec任务

在centos 6.6测试运行程序上,该过程失败。
在centos 6.4开发机器上,它仍然可以工作

source 'https://rubygems.org'

puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>=
 2.7', '< 4.0']
 gem 'diff-lcs',  '1.2.5'
 gem 'facter'
 gem 'hiera',  '1.3.4'
 gem 'json_pure',  '1.8.2'
 gem 'metaclass',  '0.0.4'
 gem 'mocha',  '1.1.0'
 gem 'puppet', puppetversion
 gem 'puppet-lint',  '1.1.0'
 gem 'puppet-syntax',  '1.4.1'
 gem 'puppetlabs_spec_helper',  '0.8.2'
 gem 'rake'
 gem 'rspec',  '2.99.0'
 gem 'rspec-core',  '2.99.2'
 gem 'rspec-expectations',  '2.99.2'
 gem 'rspec-mocks',  '2.99.3'
 gem 'rspec-puppet',  '2.0.0'
 gem 'rspec_junit_formatter',  '0.2.0'
在我的开发机器上,这个脚本(+rake任务)是这样工作的

    Fetching gem metadata from http://rubygems.org/.........
Fetching version metadata from http://rubygems.org/..
Installing rake 10.4.2
Installing CFPropertyList 2.2.8
Installing builder 3.2.2
Installing diff-lcs 1.2.5
Installing facter 2.4.1
Installing json_pure 1.8.2
Installing hiera 1.3.4
Installing metaclass 0.0.4
Installing mocha 1.1.0
Installing puppet 3.7.4
Installing puppet-lint 1.1.0
Installing puppet-syntax 1.4.1
Installing rspec-core 2.99.2
Installing rspec-expectations 2.99.2
Installing rspec-mocks 2.99.3
Installing rspec 2.99.0
Installing rspec-puppet 2.0.0
Installing puppetlabs_spec_helper 0.8.2
Installing rspec_junit_formatter 0.2.0
Using bundler 1.9.4
Bundle complete! 3 Gemfile dependencies, 20 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
manifests found
~/gitf/puppetmaster_np/local_modules/iop_4store/spec/fixtures/modules ~/gitf/puppetmaster_np/local_modules/iop_4store
~/gitf/puppetmaster_np/local_modules/iop_4store
/home/jan/.rvm/rubies/ruby-1.9.3-p484/bin/ruby -S rspec ./spec/classes/iop_4store_spec.rb --no-drb -r rspec_junit_formatter --format RspecJunitFormatter -o junit.xml --deprecation-out /dev/null
WARN: Unresolved specs during Gem::Specification.reset:
      rake (>= 0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
Removing gemset 16612......
但是,在竹代理节点上,它会执行此操作

The source :rubygems is deprecated because HTTP requests are insecure.
Please change your source to 'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
Using rake 10.4.2
Using CFPropertyList 2.2.8
Using builder 3.2.2
Using diff-lcs 1.2.5
Using facter 2.4.3
Using json_pure 1.8.2
Using hiera 2.0.0
Using metaclass 0.0.4
Using mocha 1.1.0
Using puppet 4.0.0
Using puppet-lint 1.1.0
Using puppet-syntax 2.0.0
Using rspec-support 3.2.2
Using rspec-core 3.2.3
Using rspec-expectations 3.2.1
Using rspec-mocks 3.2.1
Using rspec 3.2.0
Using rspec-puppet 2.0.1
Using puppetlabs_spec_helper 0.10.2
Using rspec_junit_formatter 0.2.0
Using bundler 1.9.4
Bundle complete! 3 Gemfile dependencies, 21 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
manifests found
~/bamboo-agent-home/xml-data/build-dir/PUP-RCTAP-JOB1/local_modules/iop_4store/spec/fixtures/modules ~/bamboo-agent-home/xml-data/build-dir/PUP-RCTAP-JOB1/local_modules/iop_4store
~/bamboo-agent-home/xml-data/build-dir/PUP-RCTAP-JOB1/local_modules/iop_4store
/usr/local/rvm/rubies/ruby-1.9.3-p484/bin/ruby -I/usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-support-3.2.2/lib:/usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb --no-drb -r rspec_junit_formatter --format RspecJunitFormatter -o junit.xml --deprecation-out /dev/null
WARN: Unresolved specs during Gem::Specification.reset:
      rake (>= 0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
/usr/local/rvm/gems/ruby-1.9.3-p484/gems/puppetlabs_spec_helper-0.10.2/lib/puppetlabs_spec_helper/module_spec_helper.rb:23:in `block in <top (required)>': undefined method `environmentpath=' for #<RSpec::Core::Configuration:0x000000025a4068> (NoMethodError)
    from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core.rb:101:in `configure'
    from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/puppetlabs_spec_helper-0.10.2/lib/puppetlabs_spec_helper/module_spec_helper.rb:22:in `<top (required)>'
    from /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in `require'
    from /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
    from /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:144:in `require'
    from /home/bamboo/bamboo-agent-home/xml-data/build-dir/PUP-RCTAP-JOB1/local_modules/iop_4store/spec/spec_helper.rb:2:in `<top (required)>'
    from /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /home/bamboo/bamboo-agent-home/xml-data/build-dir/PUP-RCTAP-JOB1/local_modules/iop_4store/spec/classes/iop_4store_spec.rb:1:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1226:in `load'
    from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1226:in `block in load_spec_files'
    from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1224:in `each'
    from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1224:in `load_spec_files'
    from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:97:in `setup'
    from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:85:in `run'
    from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:70:in `run'
    from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:38:in `invoke'
    from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/exe/rspec:4:in `<main>'
/usr/local/rvm/rubies/ruby-1.9.3-p484/bin/ruby -I/usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-support-3.2.2/lib:/usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb --no-drb -r rspec_junit_formatter --format RspecJunitFormatter -o junit.xml --deprecation-out /dev/null failed
/usr/local/rvm/gems/ruby-1.9.3-p484@27314 did not previously exist. Ignoring.
所以我的问题是,前面显示的脚本将正确的gems加载到rvm中,并“好像”执行测试puppet3.7.0。现在他们尝试加载puppet 4,但测试失败

谢谢

以下是我为“让它工作”所做的工作,我不完全清楚为什么会这样做

首先,修改gemfile,将gem依赖项的大多数版本从另一台服务器复制到它仍然工作的位置

source 'https://rubygems.org'

puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>=
 2.7', '< 4.0']
 gem 'diff-lcs',  '1.2.5'
 gem 'facter'
 gem 'hiera',  '1.3.4'
 gem 'json_pure',  '1.8.2'
 gem 'metaclass',  '0.0.4'
 gem 'mocha',  '1.1.0'
 gem 'puppet', puppetversion
 gem 'puppet-lint',  '1.1.0'
 gem 'puppet-syntax',  '1.4.1'
 gem 'puppetlabs_spec_helper',  '0.8.2'
 gem 'rake'
 gem 'rspec',  '2.99.0'
 gem 'rspec-core',  '2.99.2'
 gem 'rspec-expectations',  '2.99.2'
 gem 'rspec-mocks',  '2.99.3'
 gem 'rspec-puppet',  '2.0.0'
 gem 'rspec_junit_formatter',  '0.2.0'

(鹰眼会注意到我也在运行一个不同的ruby)

是否对
Gemfile.lock
进行了版本控制?听起来您的本地版本已锁定到
3.7.4
。总之,
puppetversion=ENV.key?('PUPPET_VERSION')?“=#{ENV['PUPPET_VERSION']}”:['>=2.7','<4.0']
应该可以解决这个问题。您是否不需要导出
PUPPET_版本,以便它显示在Ruby的环境中?(我正在考虑在您的操作系统版本之间对shell进行行为更改。)mudaasobwa这是有道理的,谢谢。费利克斯打得不错,但我不相信是那样的。我现在有一个货物崇拜的解决办法,但将等待几天,看看是否有一个真正的答案爬出木制品。我们有puppet enterprise支持,但他们不支持puppet rspec之类的东西
PUPPET_VERSION=3.7.4
ruby='1.9.3-p484'

rvm use $ruby@$$ --create
gem install bundler
ln -s .gemfile Gemfile
bundle clean --force
bundle update rspec
bundle install --gemfile=.gemfile
bundle update rspec