2015-04-17 156 views
1

不必要的版本,我有以下腳本紅寶石捆綁安裝木偶寶石

PUPPET_VERSION=3.7.4 
ruby='1.8.7-p374' 

rvm use [email protected]$$ --create 
gem install bundler 
bundle install --gemfile=.gemfile 

這工作了好幾個月,但可悲的是,現在它已決定停止工作。

這個腳本耙後調用運行一些rspec的任務

在CentOS的6.6竹測試運行過程中發生故障。
在CentOS的6.4開發機器它仍然有效

在我的機器這個腳本(+ 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/[email protected] did not previously exist. Ignoring. 

測試失敗,我敢肯定,有一個瘋狂的不同版本的木偶(和其他寶石)沒有幫助。此外,我們的系統沒有運行傀儡4

這裏是正在使用

source :rubygems 

puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 
2.7'] 
gem 'puppet', puppetversion 
gem 'puppetlabs_spec_helper', '>= 0.1.0' 
gem 'rspec_junit_formatter' 

所以我的問題是,所顯示的腳本以前加載正確的寶石成RVM和執行測試「爲的Gemfile如果「傀儡3.7.0。現在他們嘗試加載木偶4,測試失敗。

感謝

+0

是'Gemfile.lock'版本?聽起來像你的本地有puppetversion鎖定到'3.7.4'。無論如何,'puppetversion = ENV.key?('PUPPET_VERSION')? 「=#{ENV ['PUPPET_VERSION']}」:['> = 2.7','<4.0']'應該解決問題。 – mudasobwa

+0

您是否需要導出PUPPET_VERSION,以便在Ruby環境中顯示? (我正在考慮在你的操作系統版本之間的shell中的行爲改變。) –

+0

mudaasobwa這是合理的,謝謝。費利克斯很好的電話,但我不相信那是。我現在有一個貨物養殖解決方法,但會等上幾天,看看真正的答案是否爬出了木製品。我們有傀儡企業支持,但他們不支持puppet-rspec的東西 – Vorsprung

回答

0

這裏就是我所做的,以「使工作」不完全知道爲什麼這個固定

首先,改變的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' 

接下來,添加一些「捆綁更新」和「捆綁乾淨 - 強制」的腳本。

PUPPET_VERSION=3.7.4 
ruby='1.9.3-p484' 

rvm use [email protected]$$ --create 
gem install bundler 
ln -s .gemfile Gemfile 
bundle clean --force 
bundle update rspec 
bundle install --gemfile=.gemfile 
bundle update rspec 

(老鷹眼睛會注意到,我運行一個不同的紅寶石太)