在 ubuntu 14.04 上使用 chef 安装 mongodb 时出现问题

Having issue installing mongodb using chef on ubuntu 14.04

最近我在使用 mongodb and sc-mongodb 等流行食谱进行 mongodb 安装时遇到问题。我正在使用 ubuntu 14.04 流浪盒。

以下是我的使用方法:

食谱: sc-mongodb

食谱:

include_recipe 'sc-mongodb::default'

属性:

default['mongodb']['config']['smallfiles'] = true
default['mongodb']['config']['bind_ip'] = '0.0.0.0'
default['mongodb']['install_method'] = 'mongodb-org'

错误:

==> default: [2017-02-23T18:26:27+00:00] INFO: template[/etc/init/mongodb.conf] not queuing delayed action restart on service[mongodb] (delayed), as it's already been queued
==> default:
==> default: * apt_package[mongodb-org] action install
==> default:
==> default:     ================================================================================
==> default:     Error executing action `install` on resource 'apt_package[mongodb-org]'
==> default:     ================================================================================
==> default:
==> default:     Mixlib::ShellOut::ShellCommandFailed
==> default:     ------------------------------------
==> default:     Expected process to exit with [0], but received '100'
==> default:     ---- Begin output of ["apt-get", "-q", "-y", "-o", "Dpkg::Options::=\"--force-confold\"", "--force-yes", "install", "mongodb-org=2.6.12"] ----
==> default:     STDOUT: Reading package lists...
==> default:     Building dependency tree...
==> default:     Reading state information...
==> default:     The following packages were automatically installed and are no longer required:
==> default:       chef-zero erubis ohai ruby-diff-lcs ruby-erubis ruby-hashie ruby-highline
==> default:       ruby-ipaddress ruby-mime-types ruby-mixlib-authentication ruby-mixlib-cli
==> default:       ruby-mixlib-config ruby-mixlib-log ruby-mixlib-shellout ruby-net-ssh
==> default:       ruby-net-ssh-gateway ruby-net-ssh-multi ruby-rack ruby-rest-client
==> default:       ruby-sigar ruby-systemu ruby-yajl
==> default:     Use 'apt-get autoremove' to remove them.
==> default:     The following extra packages will be installed:
==> default:       mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
==> default:     The following NEW packages will be installed:
==> default:       mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell
==> default:       mongodb-org-tools
==> default:     0 upgraded, 5 newly installed, 0 to remove and 1 not upgraded.
==> default:     Need to get 116 MB of archives.
==> default:     After this operation, 293 MB of additional disk space will be used.
==> default:     Get:1 http://downloads-distro.mongodb.org/repo/ubuntu-upstart/ dist/10gen mongodb-org-shell amd64 2.6.12 [4479 kB]
==> default:     Get:2 http://downloads-distro.mongodb.org/repo/ubuntu-upstart/ dist/10gen mongodb-org-server amd64 2.6.12 [9541 kB]
==> default:     Get:3 http://downloads-distro.mongodb.org/repo/ubuntu-upstart/ dist/10gen mongodb-org-mongos amd64 2.6.12 [7214 kB]
==> default:     Get:4 http://downloads-distro.mongodb.org/repo/ubuntu-upstart/ dist/10gen mongodb-org-tools amd64 2.6.12 [94.5 MB]
==> default:     Get:5 http://downloads-distro.mongodb.org/repo/ubuntu-upstart/ dist/10gen mongodb-org amd64 2.6.12 [3650 B]
==> default:     Fetched 116 MB in 37s (3093 kB/s)
==> default:     STDERR: dpkg: error: need an action option
==> default:
==> default:     Type dpkg --help for help about installing and deinstalling packages [*];
==> default:     Use 'apt' or 'aptitude' for user-friendly package management;
==> default:     Type dpkg -Dhelp for a list of dpkg debug flag values;
==> default:     Type dpkg --force-help for a list of forcing options;
==> default:     Type dpkg-deb --help for help about manipulating *.deb files;
==> default:
==> default:     Options marked [*] produce a lot of output - pipe it through 'less' or 'more' !
==> default:     E: Sub-process /usr/bin/dpkg returned an error code (2)
==> default:     ---- End output of ["apt-get", "-q", "-y", "-o", "Dpkg::Options::=\"--force-confold\"", "--force-yes", "install", "mongodb-org=2.6.12"] ----
==> default:     Ran ["apt-get", "-q", "-y", "-o", "Dpkg::Options::=\"--force-confold\"", "--force-yes", "install", "mongodb-org=2.6.12"] returned 100
==> default:
==> default:     Resource Declaration:
==> default:     ---------------------
==> default:     # In /var/chef/cache/cookbooks/sc-mongodb/recipes/install.rb
==> default:
==> default:      67: package node['mongodb']['package_name'] do
==> default:      68:   options node['mongodb']['packager_options']
==> default:      69:   action :install
==> default:      70:   version node['mongodb']['package_version']
==> default:      71:   not_if { node['mongodb']['install_method'] == 'none' }
==> default:      72: end
==> default:      73:
==> default:
==> default:     Compiled Resource:
==> default:     ------------------
==> default:     # Declared in /var/chef/cache/cookbooks/sc-mongodb/recipes/install.rb:67:in `from_file'
==> default:
==> default:     apt_package("mongodb-org") do
==> default:       package_name "mongodb-org"
==> default:       action [:install]
==> default:       retries 0
==> default:       retry_delay 2
==> default:       default_guard_interpreter :default
==> default:       declared_type :package
==> default:       cookbook_name "sc-mongodb"
==> default:       recipe_name "install"
==> default:       options "-o Dpkg::Options::=\"--force-confold\" --force-yes"
==> default:       not_if { #code block }
==> default:     end
==> default:
==> default:     Platform:
==> default:     ---------
==> default:     x86_64-linux
==> default:

我尝试在我的 ubuntu 14.04 vagrant 中手动安装 mongodb 并且效果很好。它以前曾经工作过,但从昨天开始我就看到了这些失败。我不确定是什么改变打破了这个?有没有人见过类似的问题?

谢谢!

这是由于 Chef 12.19 中的一个错误。您可以暂时恢复到 12.18 或等待修复发布。

编辑:已修复的 12.19 版本现已发布。