michaelklishin / cassandra-chef-cookbook

Chef cookbook for Apache Cassandra, DataStax Enterprise (DSE) and DataStax agent

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot install dsc22 on Ubuntu 16.04 due to missing python-support package

matkam opened this issue · comments

Attempting to run the default cookbook on Ubuntu 16.04:

 * apt_package[cassandra] action install (up to date) 
  * apt_package[dsc22] action install 
 
    ================================================================================ 
    Error executing action `install` on resource 'apt_package[dsc22]' 
    ================================================================================ 
 
    Mixlib::ShellOut::ShellCommandFailed 
    ------------------------------------ 
    Expected process to exit with [0], but received '100' 
    ---- Begin output of apt-get -q -y --force-yes -o Dpkg::Options::="--force-confold" install dsc22=2.2.7-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: 
     dsc22 : Depends: python-support (>= 0.90.0) but it is not installable 
    STDERR: E: Unable to correct problems, you have held broken packages. 
    ---- End output of apt-get -q -y --force-yes -o Dpkg::Options::="--force-confold" install dsc22=2.2.7-1 ---- 
    Ran apt-get -q -y --force-yes -o Dpkg::Options::="--force-confold" install dsc22=2.2.7-1 returned 100 
 
    Cookbook Trace: 
    --------------- 
    /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:78:in `run_action' 
    /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block (2 levels) in converge' 
    /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `each' 
    /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block in converge' 
    /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:105:in `converge' 
 
    Resource Declaration: 
    --------------------- 
    # In /var/chef/cache/cookbooks/cassandra-dse/recipes/datastax.rb 
 
     96:   package node['cassandra']['package_name'] do 
     97:     options '--force-yes -o Dpkg::Options::="--force-confold"' 
     98:     if node['cassandra']['release'].to_s != "" 
     99:       version "#{node['cassandra']['version']}-#{node['cassandra']['release']}" 
    100:     else 
    101:       version node['cassandra']['version'] 
    102:     end 
    103:     # giving C* some time to start up 
 
    Compiled Resource: 
    ------------------ 
    # Declared in /var/chef/cache/cookbooks/cassandra-dse/recipes/datastax.rb:96:in `from_file' 
 
    apt_package("dsc22") do 
      package_name "dsc22" 
      action [:install] 
      retries 0 
      retry_delay 2 
      default_guard_interpreter :default 
      declared_type :package 
      cookbook_name "cassandra-dse" 
      recipe_name "datastax" 
      version "2.2.7-1" 
      options "--force-yes -o Dpkg::Options::=\"--force-confold\"" 
    end 
 
    Platform: 
    --------- 
    x86_64-linux 

Workaround is to manually install the package and ignoring the missing dependency:

apt-get download dsc22
sudo dpkg --force-depends -i dsc22_2.2.7-1_all.deb

But it causes problems if you try to install anything afterwards

same issue here, quite annoying.

Are there specific suggestions as to what should be changed in this cookbook to avoid this?

@michaelklishin it appears Ubuntu 16.04 dropped python-support package from its repositories, but dsc22 is still requiring it. The dsc22 package needs to change to an or statement for required dependencies python-support || dh-python

For this cookbook to support Ubuntu 16.04 and use the current dsc22 version it could always download the deb package and install it before trying dsc22. You would just need a stable location of the package download or a configurable one.

Something like this should work:

recipes/datastax.rb

remote_file 'python-support' do
  path "#{Chef::Config['file_cache_path']}/python-support_1.0.15_all.deb"
  source 'http://launchpadlibrarian.net/109052632/python-support_1.0.15_all.deb'
  action :nothing
end

dpkg_package 'python-support' do
  source "#{Chef::Config['file_cache_path']}/python-support_1.0.15_all.deb"
  notifies :create, 'remote_file[python-support]', :before
  not_if { node['platform_version'].to_f < 16.04 }
end

Shall I submit a PR with the above code? Including Ubuntu 16.04 as a platform in the kitchen file...

Interestingly, the cassandra packages dropped the requirement for python-support after 2.2.5:

2.2.8 - adduser (0 (null)) python (2 2.7) cassandra-tools (0 (null)) ntp (16 (null)) time-daemon (0 (null)) apache-cassandra1 (0 (null)) apache-cassandra1 (0 (null)) 
2.2.7 - adduser (0 (null)) python (2 2.7) cassandra-tools (0 (null)) ntp (16 (null)) time-daemon (0 (null)) apache-cassandra1 (0 (null)) apache-cassandra1 (0 (null)) 
2.2.6 - adduser (0 (null)) python (2 2.7) cassandra-tools (0 (null)) ntp (16 (null)) time-daemon (0 (null)) apache-cassandra1 (0 (null)) apache-cassandra1 (0 (null)) 
2.2.5 - adduser (0 (null)) python (2 2.7) python-support (2 0.90.0) cassandra-tools (0 (null)) ntp (16 (null)) time-daemon (0 (null)) apache-cassandra1 (0 (null)) apache-cassandra1 (0 (null)) 
2.2.4 - adduser (0 (null)) python (2 2.7) python-support (2 0.90.0) cassandra-tools (0 (null)) ntp (16 (null)) time-daemon (0 (null)) apache-cassandra1 (0 (null)) apache-cassandra1 (0 (null)) 

but the dsc packages continue to require them:

Dependencies: 
2.2.8-1 - cassandra (5 2.2.8) python (2 2.5) python-support (2 0.90.0) 
2.2.7-1 - cassandra (5 2.2.7) python (2 2.5) python-support (2 0.90.0) 
2.2.6-1 - cassandra (5 2.2.6) python (2 2.5) python-support (2 0.90.0) 
2.2.5-1 - cassandra (5 2.2.5) python (2 2.5) python-support (2 0.90.0) 
2.2.4-1 - cassandra (5 2.2.4) python (2 2.5) python-support (2 0.90.0) 

You might be able to get around this problem by going straight to the cassandra package and not installing dsc at all.

I was able to work around this problem using these attribute changes:

   'cassandra' => {
-    'package_name' => 'dsc30',
-    'version' => '3.0.9'
+    'package_name' => 'cassandra',
+    'version' => '3.0.9',
+    'release' => ''
   }

This should work for these version ranges:
cassandra 2.1 >= 2.1.14
cassandra 2.2 >= 2.2.6
cassandra 3.0 >= 3.0.6

@sethrosenblum is this something that must be document or should we change attribute defaults?

Seeing as datastax is no longer supporting or updating the dsc packages, it might be time to rethink this whole section: https://github.com/michaelklishin/cassandra-chef-cookbook/blob/master/recipes/datastax.rb#L76-L109

That way we could discard the idea of installing the dscXX packages, and instead install just the cassandra packages, possibly from the apache repo itself, which is being kept up to date: http://dl.bintray.com/apache/cassandra/

All of that sounds like a big overhaul and potentially a breaking change.

@sethrosenblum I'm fine documenting your findings, shipping what we have in master as a 4.5.0 and accepting a breaking PR for 5.0. WDYT?

We also have Chef 13 work planned which will likely be breaking but oh well, most long lived projects support at least two release branches/series and maybe it's time for this cookbook to do just that. So going to 6.x fairly quickly is OK.

@sethrosenblum I'm open to any PRs you may have in mind around this area.

Sure, I'll be getting back to this over the next few weeks.