Merge "Use charmhelpers OPENSTACK_RELEASES instead of internal KNOWN_RELEASES"
This commit is contained in:
@@ -29,7 +29,6 @@ import charmhelpers.contrib.openstack.utils as ch_utils
|
|||||||
import charmhelpers.core.hookenv as hookenv
|
import charmhelpers.core.hookenv as hookenv
|
||||||
import charmhelpers.core.host as ch_host
|
import charmhelpers.core.host as ch_host
|
||||||
import charms_openstack.ip as os_ip
|
import charms_openstack.ip as os_ip
|
||||||
import charms_openstack.os_release_data as os_release_data
|
|
||||||
|
|
||||||
ADDRESS_TYPES = os_ip.ADDRESS_MAP.keys()
|
ADDRESS_TYPES = os_ip.ADDRESS_MAP.keys()
|
||||||
|
|
||||||
@@ -807,10 +806,10 @@ class APIConfigurationAdapter(ConfigurationAdapter):
|
|||||||
def use_memcache(self):
|
def use_memcache(self):
|
||||||
release = ch_utils.get_os_codename_install_source(
|
release = ch_utils.get_os_codename_install_source(
|
||||||
self.openstack_origin)
|
self.openstack_origin)
|
||||||
if release not in os_release_data.KNOWN_RELEASES:
|
if release not in ch_utils.OPENSTACK_RELEASES:
|
||||||
return ValueError("Unkown release {}".format(release))
|
return ValueError("Unkown release {}".format(release))
|
||||||
return (os_release_data.KNOWN_RELEASES.index(release) >=
|
return (ch_utils.OPENSTACK_RELEASES.index(release) >=
|
||||||
os_release_data.KNOWN_RELEASES.index('mitaka'))
|
ch_utils.OPENSTACK_RELEASES.index('mitaka'))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def memcache_server(self):
|
def memcache_server(self):
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ import charms.reactive as reactive
|
|||||||
|
|
||||||
import charms_openstack.adapters as os_adapters
|
import charms_openstack.adapters as os_adapters
|
||||||
import charms_openstack.ip as os_ip
|
import charms_openstack.ip as os_ip
|
||||||
import charms_openstack.os_release_data as os_release_data
|
|
||||||
|
|
||||||
|
|
||||||
# _releases{} is a dictionary of release -> class that is instantiated
|
# _releases{} is a dictionary of release -> class that is instantiated
|
||||||
@@ -362,12 +361,12 @@ def get_charm_instance(release=None, *args, **kwargs):
|
|||||||
cls = _releases[known_releases[-1]]
|
cls = _releases[known_releases[-1]]
|
||||||
else:
|
else:
|
||||||
# check that the release is a valid release
|
# check that the release is a valid release
|
||||||
if release not in os_release_data.KNOWN_RELEASES:
|
if release not in os_utils.OPENSTACK_RELEASES:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"Release {} is not a known OpenStack release?".format(release))
|
"Release {} is not a known OpenStack release?".format(release))
|
||||||
release_index = os_release_data.KNOWN_RELEASES.index(release)
|
release_index = os_utils.OPENSTACK_RELEASES.index(release)
|
||||||
if (release_index <
|
if (release_index <
|
||||||
os_release_data.KNOWN_RELEASES.index(known_releases[0])):
|
os_utils.OPENSTACK_RELEASES.index(known_releases[0])):
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"Release {} is not supported by this charm. Earliest support "
|
"Release {} is not supported by this charm. Earliest support "
|
||||||
"is {} release".format(release, known_releases[0]))
|
"is {} release".format(release, known_releases[0]))
|
||||||
@@ -375,7 +374,7 @@ def get_charm_instance(release=None, *args, **kwargs):
|
|||||||
# try to find the release that is supported.
|
# try to find the release that is supported.
|
||||||
for known_release in reversed(known_releases):
|
for known_release in reversed(known_releases):
|
||||||
if (release_index >=
|
if (release_index >=
|
||||||
os_release_data.KNOWN_RELEASES.index(known_release)):
|
os_utils.OPENSTACK_RELEASES.index(known_release)):
|
||||||
cls = _releases[known_release]
|
cls = _releases[known_release]
|
||||||
break
|
break
|
||||||
if cls is None:
|
if cls is None:
|
||||||
@@ -445,7 +444,7 @@ class OpenStackCharmMeta(type):
|
|||||||
return
|
return
|
||||||
if 'release' in members.keys():
|
if 'release' in members.keys():
|
||||||
release = members['release']
|
release = members['release']
|
||||||
if release not in os_release_data.KNOWN_RELEASES:
|
if release not in os_utils.OPENSTACK_RELEASES:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"Release {} is not a known OpenStack release"
|
"Release {} is not a known OpenStack release"
|
||||||
.format(release))
|
.format(release))
|
||||||
@@ -1260,10 +1259,10 @@ class OpenStackAPICharm(OpenStackCharm):
|
|||||||
if not release:
|
if not release:
|
||||||
release = os_utils.get_os_codename_install_source(
|
release = os_utils.get_os_codename_install_source(
|
||||||
self.config['openstack-origin'])
|
self.config['openstack-origin'])
|
||||||
if release not in os_release_data.KNOWN_RELEASES:
|
if release not in os_utils.OPENSTACK_RELEASES:
|
||||||
return ValueError("Unkown release {}".format(release))
|
return ValueError("Unkown release {}".format(release))
|
||||||
return (os_release_data.KNOWN_RELEASES.index(release) >=
|
return (os_utils.OPENSTACK_RELEASES.index(release) >=
|
||||||
os_release_data.KNOWN_RELEASES.index('mitaka'))
|
os_utils.OPENSTACK_RELEASES.index('mitaka'))
|
||||||
|
|
||||||
def token_cache_pkgs(self, release=None):
|
def token_cache_pkgs(self, release=None):
|
||||||
"""Determine additional packages needed for token caching
|
"""Determine additional packages needed for token caching
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
# Copyright 2016 Canonical Ltd
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
# OpenStackCharm() - base class for build OpenStack charms from for the
|
|
||||||
# reactive framework.
|
|
||||||
|
|
||||||
# need/want absolute imports for the package imports to work properly
|
|
||||||
|
|
||||||
KNOWN_RELEASES = [
|
|
||||||
'diablo',
|
|
||||||
'essex',
|
|
||||||
'folsom',
|
|
||||||
'grizzly',
|
|
||||||
'havana',
|
|
||||||
'icehouse',
|
|
||||||
'juno',
|
|
||||||
'kilo',
|
|
||||||
'liberty',
|
|
||||||
'mitaka',
|
|
||||||
'newton',
|
|
||||||
'ocata',
|
|
||||||
]
|
|
||||||
3
tox.ini
3
tox.ini
@@ -13,6 +13,9 @@ commands = ostestr {posargs}
|
|||||||
[testenv:py27]
|
[testenv:py27]
|
||||||
basepython = python2.7
|
basepython = python2.7
|
||||||
deps = -r{toxinidir}/test-requirements.txt
|
deps = -r{toxinidir}/test-requirements.txt
|
||||||
|
# Py27 needs to be disabled as upstream charms.reactive is not Py3.5+ only
|
||||||
|
# However, we can't yet remove the actually py27 test from the gate.
|
||||||
|
commands = python -c "print('Py27 testing disabled.')" && /bin/true
|
||||||
|
|
||||||
[testenv:py34]
|
[testenv:py34]
|
||||||
basepython = python3.4
|
basepython = python3.4
|
||||||
|
|||||||
@@ -41,6 +41,25 @@ sys.modules['charmhelpers.contrib.hahelpers'] = charmhelpers.contrib.hahelpers
|
|||||||
sys.modules['charmhelpers.contrib.hahelpers.cluster'] = (
|
sys.modules['charmhelpers.contrib.hahelpers.cluster'] = (
|
||||||
charmhelpers.contrib.hahelpers.cluster)
|
charmhelpers.contrib.hahelpers.cluster)
|
||||||
|
|
||||||
|
# mock in the openstack releases so that the tests can run
|
||||||
|
# Note that these don't need to be maintained UNLESS new functionality is for
|
||||||
|
# later OpenStack releases.
|
||||||
|
charmhelpers.contrib.openstack.utils.OPENSTACK_RELEASES = (
|
||||||
|
'diablo',
|
||||||
|
'essex',
|
||||||
|
'folsom',
|
||||||
|
'grizzly',
|
||||||
|
'havana',
|
||||||
|
'icehouse',
|
||||||
|
'juno',
|
||||||
|
'kilo',
|
||||||
|
'liberty',
|
||||||
|
'mitaka',
|
||||||
|
'newton',
|
||||||
|
'ocata',
|
||||||
|
'pike',
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def _fake_retry(num_retries, base_delay=0, exc_type=Exception):
|
def _fake_retry(num_retries, base_delay=0, exc_type=Exception):
|
||||||
def _retry_on_exception_inner_1(f):
|
def _retry_on_exception_inner_1(f):
|
||||||
|
|||||||
Reference in New Issue
Block a user