rabbitmq / chef-cookbook

Development repository for Chef cookbook RabbitMQ
https://supermarket.chef.io/cookbooks/rabbitmq
Apache License 2.0
214 stars 423 forks source link

Pinned Erlang fails to install from Bintray on Ubuntu #525

Closed devsibwarra closed 5 years ago

devsibwarra commented 5 years ago

I'm using the erlang packages distributed by RabbitMQ on bintray. The Chef run is successful if I choose the latest version in that repo. If I choose an older Erlang release, the Chef run fails.

Cookbook Version: 5.8.0 OS Info: Ubuntu Xenial Chef Client: 14.10.9

Node configs

{
  'rabbitmq' => {
    'erlang' => {
      'enabled' => true,
      'version' => '1:21.3.3-1',
      'apt' => {
        'components' => ['erlang-21.x'],
      },
    },
    ...
}

Chef run error

Mixlib::ShellOut::ShellCommandFailed
------------------------------------
apt_package[rabbitmq_erlang-erlang-base] (/tmp/cookbooks/rabbitmq/providers/erlang_package_from_bintray.rb line 37) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '100'
---- Begin output of ["apt-get", "-q", "-y", "--allow-downgrades", "-o", "Dpkg::Options::=--force-confdef", "-o", "Dpkg::Options::=--force-confold", "--fix-missing", "install", "erlang-base=1:21.3.3-1"] ----
STDOUT: Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 erlang-crypto : Depends: erlang-base (= 1:21.3.7-1) but 1:21.3.3-1 is to be installed or
                          erlang-base-hipe (= 1:21.3.7-1) but it is not going to be installed
STDERR: E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
---- End output of ["apt-get", "-q", "-y", "--allow-downgrades", "-o", "Dpkg::Options::=--force-confdef", "-o", "Dpkg::Options::=--force-confold", "--fix-missing", "install", "erlang-base=1:21.3.3-1"] ----
Ran ["apt-get", "-q", "-y", "--allow-downgrades", "-o", "Dpkg::Options::=--force-confdef", "-o", "Dpkg::Options::=--force-confold", "--fix-missing", "install", "erlang-base=1:21.3.3-1"] returned 100

Resource Declaration:
---------------------
# In /tmp/cookbooks/rabbitmq/recipes/erlang_package.rb

 42:   rabbitmq_erlang_package_from_bintray 'rabbitmq_erlang' do
 43:     use_hipe node['rabbitmq']['erlang']['hipe']
 44:     version erlang_version unless erlang_version.nil?
 45:
 46:     options node['rabbitmq']['erlang']['apt']['install_options'] unless node['rabbitmq']['erlang']['apt']['install_options'].nil?
 47:     retry_delay node['rabbitmq']['erlang']['retry_delay'] unless node['rabbitmq']['erlang']['retry_delay'].nil?
 48:   end
 49: end

Compiled Resource:
------------------
# Declared in /tmp/cookbooks/rabbitmq/recipes/erlang_package.rb:42:in `from_file'

rabbitmq_erlang_package_from_bintray("rabbitmq_erlang") do
  action [:install]
  default_guard_interpreter :default
  declared_type :rabbitmq_erlang_package_from_bintray
  cookbook_name "rabbitmq"
  recipe_name "erlang_package"
  use_hipe false
  version "1:21.3.3-1"
  options ["--fix-missing"]
  retry_delay 10
end

System Info:
------------
chef_version=14.10.9
platform=ubuntu
platform_version=16.04
ruby=ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]
program_name=/usr/bin/chef-client
executable=/opt/chef-workstation/bin/chef-client

I think the correct fix for this would be to prepend base_pkg string to the DEBIAN_PACKAGES constant in providers/erlang_package_from_bintray.rb, then get rid of the resources that interact with just base_pkg

michaelklishin commented 5 years ago

Good find, thank you for #526!