upgrade: Fix pike to queens upgrade
apt.version_compare changed behaviour to return >= 1 in the event that a newer package version is detected. Resync charmhelpers code to pickup fixes for openstack upgrade detection. Change-Id: I567805dd595138acc6147edfda7fa364c8395f81 Closes-Bug: 1817384
This commit is contained in:
@@ -19,9 +19,16 @@ from charmhelpers.core import unitdata
|
||||
@cmdline.subcommand_builder('unitdata', description="Store and retrieve data")
|
||||
def unitdata_cmd(subparser):
|
||||
nested = subparser.add_subparsers()
|
||||
|
||||
get_cmd = nested.add_parser('get', help='Retrieve data')
|
||||
get_cmd.add_argument('key', help='Key to retrieve the value of')
|
||||
get_cmd.set_defaults(action='get', value=None)
|
||||
|
||||
getrange_cmd = nested.add_parser('getrange', help='Retrieve multiple data')
|
||||
getrange_cmd.add_argument('key', metavar='prefix',
|
||||
help='Prefix of the keys to retrieve')
|
||||
getrange_cmd.set_defaults(action='getrange', value=None)
|
||||
|
||||
set_cmd = nested.add_parser('set', help='Store data')
|
||||
set_cmd.add_argument('key', help='Key to set')
|
||||
set_cmd.add_argument('value', help='Value to store')
|
||||
@@ -30,6 +37,8 @@ def unitdata_cmd(subparser):
|
||||
def _unitdata_cmd(action, key, value):
|
||||
if action == 'get':
|
||||
return unitdata.kv().get(key)
|
||||
elif action == 'getrange':
|
||||
return unitdata.kv().getrange(key)
|
||||
elif action == 'set':
|
||||
unitdata.kv().set(key, value)
|
||||
unitdata.kv().flush()
|
||||
|
||||
@@ -656,7 +656,7 @@ def openstack_upgrade_available(package):
|
||||
else:
|
||||
avail_vers = get_os_version_install_source(src)
|
||||
apt.init()
|
||||
return apt.version_compare(avail_vers, cur_vers) == 1
|
||||
return apt.version_compare(avail_vers, cur_vers) >= 1
|
||||
|
||||
|
||||
def ensure_block_device(block_device):
|
||||
|
||||
@@ -186,7 +186,7 @@ class Pool(object):
|
||||
elif mode == 'writeback':
|
||||
pool_forward_cmd = ['ceph', '--id', self.service, 'osd', 'tier',
|
||||
'cache-mode', cache_pool, 'forward']
|
||||
if cmp_pkgrevno('ceph', '10.1') >= 0:
|
||||
if cmp_pkgrevno('ceph-common', '10.1') >= 0:
|
||||
# Jewel added a mandatory flag
|
||||
pool_forward_cmd.append('--yes-i-really-mean-it')
|
||||
|
||||
@@ -664,7 +664,7 @@ def create_erasure_profile(service, profile_name, erasure_plugin_name='jerasure'
|
||||
if locality is not None and durability_estimator is not None:
|
||||
raise ValueError("create_erasure_profile should be called with k, m and one of l or c but not both.")
|
||||
|
||||
luminous_or_later = cmp_pkgrevno('ceph', '12.0.0') >= 0
|
||||
luminous_or_later = cmp_pkgrevno('ceph-common', '12.0.0') >= 0
|
||||
# failure_domain changed in luminous
|
||||
if luminous_or_later:
|
||||
cmd.append('crush-failure-domain=' + failure_domain)
|
||||
@@ -769,7 +769,7 @@ def get_osds(service, device_class=None):
|
||||
:param device_class: Class of storage device for OSD's
|
||||
:type device_class: str
|
||||
"""
|
||||
luminous_or_later = cmp_pkgrevno('ceph', '12.0.0') >= 0
|
||||
luminous_or_later = cmp_pkgrevno('ceph-common', '12.0.0') >= 0
|
||||
if luminous_or_later and device_class:
|
||||
out = check_output(['ceph', '--id', service,
|
||||
'osd', 'crush', 'class',
|
||||
@@ -835,7 +835,7 @@ def set_app_name_for_pool(client, pool, name):
|
||||
|
||||
:raises: CalledProcessError if ceph call fails
|
||||
"""
|
||||
if cmp_pkgrevno('ceph', '12.0.0') >= 0:
|
||||
if cmp_pkgrevno('ceph-common', '12.0.0') >= 0:
|
||||
cmd = ['ceph', '--id', client, 'osd', 'pool',
|
||||
'application', 'enable', pool, name]
|
||||
check_call(cmd)
|
||||
|
||||
@@ -20,10 +20,8 @@ import six
|
||||
import time
|
||||
import subprocess
|
||||
|
||||
from charmhelpers.core.host import (
|
||||
get_distrib_codename,
|
||||
CompareHostReleases,
|
||||
)
|
||||
from charmhelpers.core.host import get_distrib_codename
|
||||
|
||||
from charmhelpers.core.hookenv import (
|
||||
log,
|
||||
DEBUG,
|
||||
@@ -362,14 +360,8 @@ def _get_keyid_by_gpg_key(key_material):
|
||||
:returns: A GPG key fingerprint
|
||||
:rtype: str
|
||||
"""
|
||||
# trusty, xenial and bionic handling differs due to gpg 1.x to 2.x change
|
||||
release = get_distrib_codename()
|
||||
is_gpgv2_distro = CompareHostReleases(release) >= "bionic"
|
||||
if is_gpgv2_distro:
|
||||
# --import is mandatory, otherwise fingerprint is not printed
|
||||
cmd = 'gpg --with-colons --import-options show-only --import --dry-run'
|
||||
else:
|
||||
cmd = 'gpg --with-colons --with-fingerprint'
|
||||
# Use the same gpg command for both Xenial and Bionic
|
||||
cmd = 'gpg --with-colons --with-fingerprint'
|
||||
ps = subprocess.Popen(cmd.split(),
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
|
||||
Reference in New Issue
Block a user