Fix alphanumeric comparisons for openstack and ubuntu releases

- sync charmhelpers with fix-alpha helpers
- fix up code where the alpha comparisons are done

Change-Id: I6851849b8107e59e9e6ff529348c7b183d36266b
Related-Bug: #1659575
This commit is contained in:
Alex Kavanagh 2017-03-29 17:02:09 +01:00
parent e7317bf571
commit e8a4b29784
3 changed files with 18 additions and 13 deletions

View File

@ -33,7 +33,8 @@ from charmhelpers.contrib.hahelpers.cluster import (
)
from charmhelpers.contrib.openstack.utils import (
os_release
os_release,
CompareOpenStackReleases,
)
@ -101,9 +102,10 @@ class MultiStoreContext(OSContextGenerator):
for store_relation, store_type in store_mapping.iteritems():
if relation_ids(store_relation):
stores.append(store_type)
_release = os_release('glance-common')
if ((relation_ids('cinder-volume-service') or
relation_ids('storage-backend')) and
os_release('glance-common') >= 'mitaka'):
CompareOpenStackReleases(_release) >= 'mitaka'):
# even if storage-backend is present with cinder-backend=False it
# means that glance should not store images in cinder by default
# but can read images from cinder.

View File

@ -46,13 +46,14 @@ from charmhelpers.core.host import (
adduser,
add_group,
add_user_to_group,
CompareHostReleases,
lsb_release,
mkdir,
pwgen,
service_stop,
service_start,
service_restart,
lsb_release,
write_file,
pwgen
)
from charmhelpers.contrib.openstack import (
@ -66,6 +67,11 @@ from charmhelpers.contrib.hahelpers.cluster import (
from charmhelpers.contrib.openstack.alternatives import install_alternative
from charmhelpers.contrib.openstack.utils import (
CompareOpenStackReleases,
configure_installation_source,
enable_memcache,
incomplete_relation_data,
is_unit_paused_set,
get_os_codename_install_source,
git_clone_and_install,
git_default_repos,
@ -74,16 +80,12 @@ from charmhelpers.contrib.openstack.utils import (
git_pip_venv_dir,
git_src_dir,
git_yaml_value,
configure_installation_source,
os_release,
is_unit_paused_set,
make_assess_status_func,
os_application_version_set,
os_release,
pause_unit,
resume_unit,
incomplete_relation_data,
os_application_version_set,
token_cache_pkgs,
enable_memcache,
)
from charmhelpers.core.templating import render
@ -350,13 +352,14 @@ def services():
def setup_ipv6():
ubuntu_rel = lsb_release()['DISTRIB_CODENAME'].lower()
if ubuntu_rel < "trusty":
if CompareHostReleases(ubuntu_rel) < "trusty":
raise Exception("IPv6 is not supported in the charms for Ubuntu "
"versions less than Trusty 14.04")
# Need haproxy >= 1.5.3 for ipv6 so for Trusty if we are <= Kilo we need to
# use trusty-backports otherwise we can use the UCA.
if ubuntu_rel == 'trusty' and os_release('glance') < 'liberty':
if (ubuntu_rel == 'trusty' and
CompareOpenStackReleases(os_release('glance')) < 'liberty'):
add_source('deb http://archive.ubuntu.com/ubuntu trusty-backports '
'main')
apt_update()

View File

@ -14,7 +14,7 @@ install_command =
pip install --allow-unverified python-apt {opts} {packages}
commands = ostestr {posargs}
whitelist_externals = juju
passenv = HOME TERM AMULET_*
passenv = HOME TERM AMULET_* CS_API_*
[testenv:py27]
basepython = python2.7