Fix get_mon_map() for octopus and later

The "ceph mon_status" command seems to have disappeared on octopus and
later, and is replaced by "ceph quorum_status". This changes the
get_mon_map() function to detect the underlying ceph version and do the
right thing.

Note that the fix is actually in charm-helpers, and this has been
manually synced into the charm [1].

Note: also picked pyparsing pin to allow tests to run.

Cherry-picked from master.

[1] https://github.com/juju/charm-helpers/pull/659

Change-Id: I59cf6fc19cf2a91b0aef37059cdb0ed37379b5cb
Closes-Bug: #1951094
This commit is contained in:
Alex Kavanagh 2021-11-26 12:31:43 +00:00
parent a261c77639
commit 33b59af452
2 changed files with 4 additions and 1 deletions

View File

@ -813,8 +813,10 @@ def get_mon_map(service):
ceph command fails.
"""
try:
octopus_or_later = cmp_pkgrevno('ceph-common', '15.0.0') >= 0
mon_status_cmd = 'quorum_status' if octopus_or_later else 'mon_status'
mon_status = check_output(['ceph', '--id', service,
'mon_status', '--format=json'])
mon_status_cmd, '--format=json'])
if six.PY3:
mon_status = mon_status.decode('UTF-8')
try:

View File

@ -7,6 +7,7 @@
# requirements. They are intertwined. Also, Zaza itself should specify
# all of its own requirements and if it doesn't, fix it there.
#
pyparsing<3.0.0 # aodhclient is pinned in zaza and needs pyparsing < 3.0.0, but cffi also needs it, so pin here.
cffi==1.14.6; python_version < '3.6' # cffi 1.15.0 drops support for py35.
setuptools<50.0.0 # https://github.com/pypa/setuptools/commit/04e3df22df840c6bb244e9b27bc56750c44b7c85