py3: Switch to Python 3 at Rocky
Misc updates to support the switch to Python 3 for Rocky: - Change default smoke test target to bionic-rocky - Resync charm helpers Charm does not directly install any python packages, so cinder charm will deal with upgrade and switch to py3. Change-Id: I77d412a62f4a5362c7221b869f4f9c03d5d87737
This commit is contained in:
parent
154b84d9b6
commit
131a849452
@ -1519,6 +1519,14 @@ class NeutronAPIContext(OSContextGenerator):
|
|||||||
'rel_key': 'enable-qos',
|
'rel_key': 'enable-qos',
|
||||||
'default': False,
|
'default': False,
|
||||||
},
|
},
|
||||||
|
'enable_nsg_logging': {
|
||||||
|
'rel_key': 'enable-nsg-logging',
|
||||||
|
'default': False,
|
||||||
|
},
|
||||||
|
'nsg_log_output_base': {
|
||||||
|
'rel_key': 'nsg-log-output-base',
|
||||||
|
'default': None,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
ctxt = self.get_neutron_options({})
|
ctxt = self.get_neutron_options({})
|
||||||
for rid in relation_ids('neutron-plugin-api'):
|
for rid in relation_ids('neutron-plugin-api'):
|
||||||
|
@ -186,7 +186,7 @@ SWIFT_CODENAMES = OrderedDict([
|
|||||||
('queens',
|
('queens',
|
||||||
['2.16.0', '2.17.0']),
|
['2.16.0', '2.17.0']),
|
||||||
('rocky',
|
('rocky',
|
||||||
['2.18.0']),
|
['2.18.0', '2.19.0']),
|
||||||
])
|
])
|
||||||
|
|
||||||
# >= Liberty version->codename mapping
|
# >= Liberty version->codename mapping
|
||||||
@ -1733,3 +1733,31 @@ def is_unit_upgrading_set():
|
|||||||
return not(not(kv.get('unit-upgrading')))
|
return not(not(kv.get('unit-upgrading')))
|
||||||
except Exception:
|
except Exception:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def series_upgrade_prepare(pause_unit_helper=None, configs=None):
|
||||||
|
""" Run common series upgrade prepare tasks.
|
||||||
|
|
||||||
|
:param pause_unit_helper: function: Function to pause unit
|
||||||
|
:param configs: OSConfigRenderer object: Configurations
|
||||||
|
:returns None:
|
||||||
|
"""
|
||||||
|
set_unit_upgrading()
|
||||||
|
if pause_unit_helper and configs:
|
||||||
|
if not is_unit_paused_set():
|
||||||
|
pause_unit_helper(configs)
|
||||||
|
|
||||||
|
|
||||||
|
def series_upgrade_complete(resume_unit_helper=None, configs=None):
|
||||||
|
""" Run common series upgrade complete tasks.
|
||||||
|
|
||||||
|
:param resume_unit_helper: function: Function to resume unit
|
||||||
|
:param configs: OSConfigRenderer object: Configurations
|
||||||
|
:returns None:
|
||||||
|
"""
|
||||||
|
clear_unit_paused()
|
||||||
|
clear_unit_upgrading()
|
||||||
|
if configs:
|
||||||
|
configs.write_all()
|
||||||
|
if resume_unit_helper:
|
||||||
|
resume_unit_helper(configs)
|
||||||
|
@ -48,6 +48,7 @@ INFO = "INFO"
|
|||||||
DEBUG = "DEBUG"
|
DEBUG = "DEBUG"
|
||||||
TRACE = "TRACE"
|
TRACE = "TRACE"
|
||||||
MARKER = object()
|
MARKER = object()
|
||||||
|
SH_MAX_ARG = 131071
|
||||||
|
|
||||||
cache = {}
|
cache = {}
|
||||||
|
|
||||||
@ -98,7 +99,7 @@ def log(message, level=None):
|
|||||||
command += ['-l', level]
|
command += ['-l', level]
|
||||||
if not isinstance(message, six.string_types):
|
if not isinstance(message, six.string_types):
|
||||||
message = repr(message)
|
message = repr(message)
|
||||||
command += [message]
|
command += [message[:SH_MAX_ARG]]
|
||||||
# Missing juju-log should not cause failures in unit tests
|
# Missing juju-log should not cause failures in unit tests
|
||||||
# Send log output to stderr
|
# Send log output to stderr
|
||||||
try:
|
try:
|
||||||
|
@ -84,6 +84,7 @@ module = "charmhelpers.fetch.%s" % __platform__
|
|||||||
fetch = importlib.import_module(module)
|
fetch = importlib.import_module(module)
|
||||||
|
|
||||||
filter_installed_packages = fetch.filter_installed_packages
|
filter_installed_packages = fetch.filter_installed_packages
|
||||||
|
filter_missing_packages = fetch.filter_missing_packages
|
||||||
install = fetch.apt_install
|
install = fetch.apt_install
|
||||||
upgrade = fetch.apt_upgrade
|
upgrade = fetch.apt_upgrade
|
||||||
update = _fetch_update = fetch.apt_update
|
update = _fetch_update = fetch.apt_update
|
||||||
@ -96,6 +97,7 @@ if __platform__ == "ubuntu":
|
|||||||
apt_update = fetch.apt_update
|
apt_update = fetch.apt_update
|
||||||
apt_upgrade = fetch.apt_upgrade
|
apt_upgrade = fetch.apt_upgrade
|
||||||
apt_purge = fetch.apt_purge
|
apt_purge = fetch.apt_purge
|
||||||
|
apt_autoremove = fetch.apt_autoremove
|
||||||
apt_mark = fetch.apt_mark
|
apt_mark = fetch.apt_mark
|
||||||
apt_hold = fetch.apt_hold
|
apt_hold = fetch.apt_hold
|
||||||
apt_unhold = fetch.apt_unhold
|
apt_unhold = fetch.apt_unhold
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from subprocess import check_call
|
from subprocess import STDOUT, check_output
|
||||||
from charmhelpers.fetch import (
|
from charmhelpers.fetch import (
|
||||||
BaseFetchHandler,
|
BaseFetchHandler,
|
||||||
UnhandledSource,
|
UnhandledSource,
|
||||||
@ -55,7 +55,7 @@ class BzrUrlFetchHandler(BaseFetchHandler):
|
|||||||
cmd = ['bzr', 'branch']
|
cmd = ['bzr', 'branch']
|
||||||
cmd += cmd_opts
|
cmd += cmd_opts
|
||||||
cmd += [source, dest]
|
cmd += [source, dest]
|
||||||
check_call(cmd)
|
check_output(cmd, stderr=STDOUT)
|
||||||
|
|
||||||
def install(self, source, dest=None, revno=None):
|
def install(self, source, dest=None, revno=None):
|
||||||
url_parts = self.parse_url(source)
|
url_parts = self.parse_url(source)
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from subprocess import check_call, CalledProcessError
|
from subprocess import check_output, CalledProcessError, STDOUT
|
||||||
from charmhelpers.fetch import (
|
from charmhelpers.fetch import (
|
||||||
BaseFetchHandler,
|
BaseFetchHandler,
|
||||||
UnhandledSource,
|
UnhandledSource,
|
||||||
@ -50,7 +50,7 @@ class GitUrlFetchHandler(BaseFetchHandler):
|
|||||||
cmd = ['git', 'clone', source, dest, '--branch', branch]
|
cmd = ['git', 'clone', source, dest, '--branch', branch]
|
||||||
if depth:
|
if depth:
|
||||||
cmd.extend(['--depth', depth])
|
cmd.extend(['--depth', depth])
|
||||||
check_call(cmd)
|
check_output(cmd, stderr=STDOUT)
|
||||||
|
|
||||||
def install(self, source, branch="master", dest=None, depth=None):
|
def install(self, source, branch="master", dest=None, depth=None):
|
||||||
url_parts = self.parse_url(source)
|
url_parts = self.parse_url(source)
|
||||||
|
@ -189,6 +189,18 @@ def filter_installed_packages(packages):
|
|||||||
return _pkgs
|
return _pkgs
|
||||||
|
|
||||||
|
|
||||||
|
def filter_missing_packages(packages):
|
||||||
|
"""Return a list of packages that are installed.
|
||||||
|
|
||||||
|
:param packages: list of packages to evaluate.
|
||||||
|
:returns list: Packages that are installed.
|
||||||
|
"""
|
||||||
|
return list(
|
||||||
|
set(packages) -
|
||||||
|
set(filter_installed_packages(packages))
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def apt_cache(in_memory=True, progress=None):
|
def apt_cache(in_memory=True, progress=None):
|
||||||
"""Build and return an apt cache."""
|
"""Build and return an apt cache."""
|
||||||
from apt import apt_pkg
|
from apt import apt_pkg
|
||||||
@ -248,6 +260,14 @@ def apt_purge(packages, fatal=False):
|
|||||||
_run_apt_command(cmd, fatal)
|
_run_apt_command(cmd, fatal)
|
||||||
|
|
||||||
|
|
||||||
|
def apt_autoremove(purge=True, fatal=False):
|
||||||
|
"""Purge one or more packages."""
|
||||||
|
cmd = ['apt-get', '--assume-yes', 'autoremove']
|
||||||
|
if purge:
|
||||||
|
cmd.append('--purge')
|
||||||
|
_run_apt_command(cmd, fatal)
|
||||||
|
|
||||||
|
|
||||||
def apt_mark(packages, mark, fatal=False):
|
def apt_mark(packages, mark, fatal=False):
|
||||||
"""Flag one or more packages using apt-mark."""
|
"""Flag one or more packages using apt-mark."""
|
||||||
log("Marking {} as {}".format(packages, mark))
|
log("Marking {} as {}".format(packages, mark))
|
||||||
|
@ -48,6 +48,7 @@ INFO = "INFO"
|
|||||||
DEBUG = "DEBUG"
|
DEBUG = "DEBUG"
|
||||||
TRACE = "TRACE"
|
TRACE = "TRACE"
|
||||||
MARKER = object()
|
MARKER = object()
|
||||||
|
SH_MAX_ARG = 131071
|
||||||
|
|
||||||
cache = {}
|
cache = {}
|
||||||
|
|
||||||
@ -98,7 +99,7 @@ def log(message, level=None):
|
|||||||
command += ['-l', level]
|
command += ['-l', level]
|
||||||
if not isinstance(message, six.string_types):
|
if not isinstance(message, six.string_types):
|
||||||
message = repr(message)
|
message = repr(message)
|
||||||
command += [message]
|
command += [message[:SH_MAX_ARG]]
|
||||||
# Missing juju-log should not cause failures in unit tests
|
# Missing juju-log should not cause failures in unit tests
|
||||||
# Send log output to stderr
|
# Send log output to stderr
|
||||||
try:
|
try:
|
||||||
|
2
tox.ini
2
tox.ini
@ -65,7 +65,7 @@ basepython = python2.7
|
|||||||
deps = -r{toxinidir}/requirements.txt
|
deps = -r{toxinidir}/requirements.txt
|
||||||
-r{toxinidir}/test-requirements.txt
|
-r{toxinidir}/test-requirements.txt
|
||||||
commands =
|
commands =
|
||||||
bundletester -vl DEBUG -r json -o func-results.json gate-basic-bionic-queens --no-destroy
|
bundletester -vl DEBUG -r json -o func-results.json gate-basic-bionic-rocky --no-destroy
|
||||||
|
|
||||||
[testenv:func27-dfs]
|
[testenv:func27-dfs]
|
||||||
# Charm Functional Test
|
# Charm Functional Test
|
||||||
|
Loading…
Reference in New Issue
Block a user