![如何在 AWS Opsworks 中升级 Ruby Bundle 版本](https://linux22.com/image/745718/%E5%A6%82%E4%BD%95%E5%9C%A8%20AWS%20Opsworks%20%E4%B8%AD%E5%8D%87%E7%BA%A7%20Ruby%20Bundle%20%E7%89%88%E6%9C%AC.png)
我有一个在 AWS Opsworks 上运行的项目,其当前捆绑程序版本为1.5.3在Ruby 2.2.2。
我想将捆绑版本升级到1.17.3
但当我尝试这样做时,我收到了这个错误
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /usr/local/bin/gem install bundler -q --no-rdoc --no-ri -v "1.11.2" ----
STDOUT:
STDERR: ERROR: Error installing bundler:
"bundle" from bundler conflicts with /usr/local/bin/bundle
---- End output of /usr/local/bin/gem install bundler -q --no-rdoc --no-ri -v "1.11.2" ----
Ran /usr/local/bin/gem install bundler -q --no-rdoc --no-ri -v "1.11.2" returned 1
Resource Declaration:
---------------------
# In /var/lib/aws/opsworks/cache.stage2/cookbooks/opsworks_bundler/recipes/default.rb
2: gem_package "Installing Bundler #{node[:opsworks_bundler][:version]}" do
3: gem_binary node[:dependencies][:gem_binary]
4: retries 2
5: package_name "bundler"
6: action :install
7: version node[:opsworks_bundler][:version]
8: if Gem::Version.new(node[:opsworks_rubygems][:version]) > Gem::Version.new("2.6.14")
9: options "--force"
10: end
11: end
Compiled Resource:
------------------
# Declared in /var/lib/aws/opsworks/cache.stage2/cookbooks/opsworks_bundler/recipes/default.rb:2:in `from_file'
gem_package("Installing Bundler 1.11.2") do
provider Chef::Provider::Package::Rubygems
action [:install]
retries 0
retry_delay 2
package_name "bundler"
version "1.11.2"
cookbook_name "opsworks_bundler"
recipe_name "default"
gem_binary "/usr/local/bin/gem"
end
[2019-12-04T04:42:03+00:00] INFO: Running queued delayed notifications before re-raising exception
[2019-12-04T04:42:03+00:00] ERROR: Running exception handlers
[2019-12-04T04:42:03+00:00] ERROR: Exception handlers complete
[2019-12-04T04:42:03+00:00] FATAL: Stacktrace dumped to /var/lib/aws/opsworks/cache.stage2/chef-stacktrace.out
[2019-12-04T04:42:03+00:00] ERROR: gem_package[Installing Bundler 1.11.2] (opsworks_bundler::default line 2) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /usr/local/bin/gem install bundler -q --no-rdoc --no-ri -v "1.11.2" ----
STDOUT:
STDERR: ERROR: Error installing bundler:
"bundle" from bundler conflicts with /usr/local/bin/bundle
---- End output of /usr/local/bin/gem install bundler -q --no-rdoc --no-ri -v "1.11.2" ----
Ran /usr/local/bin/gem install bundler -q --no-rdoc --no-ri -v "1.11.2" returned 1
[2019-12-04T04:42:03+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
当我bundle -v
在服务器上运行时,我得到的 bundler 版本为1.5.3.无论我做什么,我都无法改变捆绑版本。
root@hades:/srv/www/app_unicorn/current# which gem
/usr/local/bin/gem
root@hades:/srv/www/app_unicorn/current# which ruby
/usr/local/bin/ruby
root@hades:/srv/www/app_unicorn/current# which bundle
/usr/local/bin/bundle
root@hades:/srv/www/app_unicorn/current# gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.2.2
- RUBY VERSION: 2.1.9 (2016-03-30 patchlevel 490) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.1.0
- RUBY EXECUTABLE: /usr/local/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /root/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.1.0
- /root/.gem/ruby/2.1.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
root@hades:/srv/www/app_unicorn/current# bundle env
Bundler 1.5.3
Ruby 2.1.9 (2016-03-30 patchlevel 490) [x86_64-linux]
Rubygems 2.2.2
GEM_HOME
Bundler settings
path
Set for your local app (/srv/www/app_unicorn/releases/20061825/.bundle/config): "/home/deploy/.bundler/app_unicorn"
without
Set for your local app (/srv/www/app_unicorn/releases/20061825/.bundle/config): "test:development"
disable_shared_gems
Set for your local app (/srv/www/app_unicorn/releases/20061825/.bundle/config): "1"
有人让我调查这个问题。但我不知道该怎么做。https://github.com/chef/chef-dk/issues/536
如何在厨师菜谱或其他任何地方添加配置来更新捆绑版本?
我的烹饪书:-https://gist.github.com/nijeeshjoshy/90ef2dfc693c869205bad589ef1b0e23