diff --git a/hooks/glance_contexts.py b/hooks/glance_contexts.py index 10738fcc..757d40a1 100644 --- a/hooks/glance_contexts.py +++ b/hooks/glance_contexts.py @@ -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. diff --git a/hooks/glance_utils.py b/hooks/glance_utils.py index 03ae9220..6f1113bf 100644 --- a/hooks/glance_utils.py +++ b/hooks/glance_utils.py @@ -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() diff --git a/tox.ini b/tox.ini index d8d8d038..1610be31 100644 --- a/tox.ini +++ b/tox.ini @@ -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