voxpupuli / puppet-cassandra

Installs Cassandra & DataStax Agent on RHEL/Ubuntu/Debian.
https://forge.puppetlabs.com/puppet/cassandra
Apache License 2.0
13 stars 65 forks source link

When installing cassandra dsc22 it tries to install cassandra 3.0.0 and as dependecy 2.2.3 is needed #136

Closed mantunovic closed 9 years ago

mantunovic commented 9 years ago

Error: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install dsc22' returned 100: 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: cassandra (= 2.2.3) but 3.0.0 is to be installed E: Unable to correct problems, you have held broken packages. Error: /Stage[main]/Cassandra/Package[dsc22]/ensure: change from purged to present failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install dsc22' returned 100: 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: cassandra (= 2.2.3) but 3.0.0 is to be installed E: Unable to correct problems, you have held broken packages.

al4 commented 9 years ago

This seems to be a problem with the Datastax repo. IMO, they shouldn't be mixing distributions of Cassandra in the same repo, and I'm not sure there's much this puppet module can about it. If you do apt-get install dsc22 you will get the same error.

The workaround I've used is to add a separate cassandra package declaration based on the value of cassandra::package_ensure:

$dsc_ver  = hiera('cassandra::package_ensure')
$cass_ver = split($dsc_ver, '-')[0]
package { 'cassandra':
    ensure => $cass_ver,
    before  => Class['cassandra'],
}

(note we use hiera for the class parameters, obviously you will need to use a different definition of $dsc_ver if you declare the cassandra class as the documentation suggests)

This is not a great solution, it's brittle and assumes that the dsc package has a hyphen in the version while the cassandra package does not, but it works for the current situation and allowed me to keep our hiera data clean.

dallinb commented 9 years ago

Hi,

Thanks for both the initial heads up @mantunovic and the helpful comment from @al4. Will take a look at this for what affect Cassandra 3 is having on all distros and if we can put in a workaround.

dallinb commented 9 years ago

The problem does not seem to affect the Red Hat family so I guess the dependencies are defined correctly in the dsc22 package:

# rpm -qa | grep cassandra
cassandra22-2.2.3-1.noarch
cassandra22-tools-2.2.3-1.noarch

However, things are not so pretty on the Debian family. A workaround with the existing module is to use the package_name and package_ensure parameters:

class { 'cassandra':
  package_name                => 'cassandra',
  package_ensure              => '2.2.3',
}

This is obviously only a workaround for now. I consider changing the default package_name from 'dsc22' to 'cassandra' as possibly a breaking fix. Then again I had hoped for a bit more time to prepare what will be version 2 of this module to handle Cassandra 3. Looks like I have to bring this forward quicker.

In the short term, I will bring out a patch release with this suggested workaround in the README (probably in the Getting Started section) and start work on integrating with Cassandra 3 with a module where the package name defaults to cassandra.

I am of course open to suggestions if anybody has a different opinion on the best way to proceed. Possibly take that as a chat on the Gitter thread (follow the link from the buttons on the README).

al4 commented 9 years ago

I had a look at the dsc22 package and it doesn't actually do anything. The control file contains:

Package: dsc22
Source: dsc
Version: 2.2.3-1
Architecture: all
Maintainer: DataStax Team <info@datastax.com>
Installed-Size: 40
Depends: cassandra (= 2.2.3), python (>= 2.5), python-support (>= 0.90.0)
Section: misc
Priority: extra
Homepage: http://www.datastax.com/products/community
Description: DataStax Community Edition is a free packaged distribution of the
 Apache Cassandra database.
 .
 This package depends on the other components of DSC.

I don't even know why it depends on python, as there are no python files in the data archive:

$ tar -xvf ./data.tar.gz
x ./
x ./usr/
x ./usr/share/
x ./usr/share/doc/
x ./usr/share/doc/dsc22/
x ./usr/share/doc/dsc22/changelog.Debian.gz
x ./usr/share/doc/dsc22/copyright

Even the copyright file is useless, referencing a file which doesn't exist:

$ cat ./usr/share/doc/dsc22/copyright
Please see the LICENSE.txt file included in the DSC package.

Thus, its only purpose seems to be to install Cassandra, and it fails pretty spectacularly at that task, so just directly referencing the cassandra package as you suggest is less a workaround and more a fix from my point of view. :-)

Datastax enterprise will probably be a different story however.

mantunovic commented 9 years ago

Thanks a lot for all answers, I fixed it by adding cassandra package with specific version to be installed before dsc22 but would be nice to have solution in official module here so I can easily upgrade when You guys add something new.

Regards, Mladen

dallinb commented 9 years ago

This evening I'll check if the YUM package for the Red Hat family is as sparse as the Apt package for Debian. If it is and it only installs the cassandra package and nothing else I don't think this is a breaking fix and the default package name will be changed.

@mantunovic did the code snippet I suggested fix your problem in the meantime rather than having to add new package resources to your manifest?

dallinb commented 9 years ago

On Red Hat, the YUM package is also only to be used as a mechanism for installing the cassandra22 package (note that on Debian/Ubuntu the package is simply called cassandra). Therefore I am just putting the finishing touches to what will become release 1.9.2 of the module. This release will change the default package name from dsc22 to cassandra and cassandra22 on Debian and Red Hat families respectively.

al4 commented 9 years ago

Brilliant, thanks @dallinb for your work on this module :)

ghost commented 9 years ago

Guys, ur fantastic. I came across this issue 3 hours ago, went for lunch, came back and it got fixed :-)

alejandro11k commented 8 years ago

$ sudo apt-get install dsc22=2.2.3-1 cassandra=2.2.3 $ sudo apt-get install cassandra-tools=2.2.3

http://apoup.blogspot.com.ar/2015_11_01_archive.html

ivanst-stoyanov commented 8 years ago

Thank you @alejandro11k . This was exactly what I was looking for.

lindo-jmm commented 8 years ago

Thanks @alejandro11k! This has been a little on the painful side..