cassandra charm fails to deploy on Ubuntu 18.04

Bug #1908147 reported by Brian Murray on 2020-12-14
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cassandra Juju Charm
Undecided
Unassigned
Charm Helpers
Undecided
Unassigned

Bug Description

2020-12-14 22:09:31 WARNING install Traceback (most recent call last):
2020-12-14 22:09:31 WARNING install File "/var/lib/juju/agents/unit-cassandra-0/charm/hooks/install", line 22, in <module>
2020-12-14 22:09:31 WARNING install main()
2020-12-14 22:09:31 WARNING install File "/var/lib/juju/agents/unit-cassandra-0/.venv/lib/python3.6/site-packages/charms/reactive/__init__.
py", line 74, in main
2020-12-14 22:09:31 WARNING install bus.dispatch(restricted=restricted_mode)
2020-12-14 22:09:31 WARNING install File "/var/lib/juju/agents/unit-cassandra-0/.venv/lib/python3.6/site-packages/charms/reactive/bus.py",
line 390, in dispatch
2020-12-14 22:09:31 WARNING install _invoke(other_handlers)
2020-12-14 22:09:31 WARNING install File "/var/lib/juju/agents/unit-cassandra-0/.venv/lib/python3.6/site-packages/charms/reactive/bus.py",
line 359, in _invoke
2020-12-14 22:09:31 WARNING install handler.invoke()
2020-12-14 22:09:31 WARNING install File "/var/lib/juju/agents/unit-cassandra-0/.venv/lib/python3.6/site-packages/charms/reactive/bus.py",
line 181, in invoke
2020-12-14 22:09:31 WARNING install self._action(*args)
2020-12-14 22:09:31 WARNING install File "/var/lib/juju/agents/unit-cassandra-0/charm/reactive/cassandra/install.py", line 311, in reset_al
l_io_schedulers
2020-12-14 22:09:31 WARNING install cassandra.ensure_all_database_directories()
2020-12-14 22:09:31 WARNING install File "lib/charms/layer/cassandra.py", line 521, in ensure_all_database_directories
2020-12-14 22:09:31 WARNING install db_dirs = get_all_database_directories()
2020-12-14 22:09:31 WARNING install File "lib/charms/layer/cassandra.py", line 495, in get_all_database_directories
2020-12-14 22:09:31 WARNING install if has_cassandra_version('3.0'):
2020-12-14 22:09:31 WARNING install File "lib/charms/layer/cassandra.py", line 198, in has_cassandra_version
2020-12-14 22:09:31 WARNING install assert cassandra_version is not None, 'Cassandra package not yet installed'
2020-12-14 22:09:31 WARNING install AssertionError: Cassandra package not yet installed
2020-12-14 22:09:31 ERROR juju.worker.uniter.operation runhook.go:136 hook "install" (via explicit, bespoke hook script) failed: exit status
1

The package is installed though:

ubuntu@juju-995ff0-0:~$ apt-cache policy cassandra
cassandra:
  Installed: 3.11.9
  Candidate: 3.11.9
  Version table:
 *** 3.11.9 500
        500 http://www.apache.org/dist/cassandra/debian 311x/main amd64 Packages
        100 /var/lib/dpkg/status

Revision history for this message
Stuart Bishop (stub) wrote :

I couldn't reproduce this with xenial, bionic or focal. Looking at the code, it is relying on charm-helpers to get the installed package version, which uses apt-cache and dpkg-query calls. Unless the apt cache was slow to update for some reason, it should be seeing the same information as the CLI.

Revision history for this message
Brian Murray (brian-murray) wrote :

Yeah, it seems there is something goofy with the charmhelper:

>>> from charmhelpers import fetch
>>> cache = fetch.apt_cache()
>>> cache['cassandra']
{'version': '3.11.9', 'architecture': None, 'maintainer': 'Eric Evans <email address hidden>', 'installed-size': '39639', 'depends': 'openjdk-8-jre-headless | java8-runtime, adduser, python (>= 2.7)', 'recommends': 'ntp | time-daemon', 'suggests': 'cassandra-tools', 'conflicts': 'apache-cassandra1', 'replaces': 'apache-cassandra1', 'homepage': 'http://cassandra.apache.org', 'priority': 'extra', 'section': 'misc', 'filename': 'pool/main/c/cassandra/cassandra_3.11.9_all.deb', 'size': '30639236', 'sha256': '1374b0ed57a58f6f23ad558273035b145e818d195722d4616867d4a7345c0da6', 'sha1': '5a77dcfa290604e6950b6c1d30083d6126c51976', 'md5sum': 'ee574b746ccdd919747776c73dd55f0e', 'description': 'distributed storage system for structured data\nCassandra is a distributed (peer-to-peer) system for the management\nand storage of structured data.', 'description-md5': '449c17857a17bf5afa4d96fab0cc89e5', 'name': 'cassandra', 'current_ver': None}

Revision history for this message
Brian Murray (brian-murray) wrote :

And I think it is because the package is held:

ubuntu@juju-d6d3e6-0:~$ dpkg-query --list cassandra
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=============================-===================-===================-===============================================================
hi cassandra 3.11.9 all distributed storage system for structured data

While the charmhelper checks for a status of 'ii'.

Revision history for this message
Brian Murray (brian-murray) wrote :

If that were to change to "not in ['ii', 'hi']" everything would be better.

Changed in cassandra-charm:
status: New → Fix Released
Changed in charm-helpers:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers