Fix install hook on Groovy
Also add Groovy to the test gate and sync libraries Change-Id: If32560a88cfa6735bf5e502a70e6b84b0171f045 Closes-Bug: #1903546
This commit is contained in:
parent
a2797151f7
commit
2e799e5cf0
@ -33,6 +33,7 @@ INTERNAL = 'int'
|
||||
ADMIN = 'admin'
|
||||
ACCESS = 'access'
|
||||
|
||||
# TODO: reconcile 'int' vs 'internal' binding names
|
||||
ADDRESS_MAP = {
|
||||
PUBLIC: {
|
||||
'binding': 'public',
|
||||
@ -58,6 +59,14 @@ ADDRESS_MAP = {
|
||||
'fallback': 'private-address',
|
||||
'override': 'os-access-hostname',
|
||||
},
|
||||
# Note (thedac) bridge to begin the reconciliation between 'int' vs
|
||||
# 'internal' binding names
|
||||
'internal': {
|
||||
'binding': 'internal',
|
||||
'config': 'os-internal-network',
|
||||
'fallback': 'private-address',
|
||||
'override': 'os-internal-hostname',
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@ -195,3 +204,10 @@ def get_vip_in_network(network):
|
||||
if is_address_in_network(network, vip):
|
||||
matching_vip = vip
|
||||
return matching_vip
|
||||
|
||||
|
||||
def get_default_api_bindings():
|
||||
_default_bindings = []
|
||||
for binding in [INTERNAL, ADMIN, PUBLIC]:
|
||||
_default_bindings.append(ADDRESS_MAP[binding]['binding'])
|
||||
return _default_bindings
|
||||
|
@ -230,7 +230,7 @@ SWIFT_CODENAMES = OrderedDict([
|
||||
('ussuri',
|
||||
['2.24.0', '2.25.0']),
|
||||
('victoria',
|
||||
['2.25.0']),
|
||||
['2.25.0', '2.26.0']),
|
||||
])
|
||||
|
||||
# >= Liberty version->codename mapping
|
||||
|
@ -41,6 +41,7 @@ from subprocess import (
|
||||
)
|
||||
from charmhelpers import deprecate
|
||||
from charmhelpers.core.hookenv import (
|
||||
application_name,
|
||||
config,
|
||||
service_name,
|
||||
local_unit,
|
||||
@ -162,6 +163,17 @@ def get_osd_settings(relation_name):
|
||||
return _order_dict_by_key(osd_settings)
|
||||
|
||||
|
||||
def send_application_name(relid=None):
|
||||
"""Send the application name down the relation.
|
||||
|
||||
:param relid: Relation id to set application name in.
|
||||
:type relid: str
|
||||
"""
|
||||
relation_set(
|
||||
relation_id=relid,
|
||||
relation_settings={'application-name': application_name()})
|
||||
|
||||
|
||||
def send_osd_settings():
|
||||
"""Pass on requested OSD settings to osd units."""
|
||||
try:
|
||||
@ -1074,7 +1086,10 @@ def create_erasure_profile(service, profile_name,
|
||||
erasure_plugin_technique=None):
|
||||
"""Create a new erasure code profile if one does not already exist for it.
|
||||
|
||||
Updates the profile if it exists. Please refer to [0] for more details.
|
||||
Profiles are considered immutable so will not be updated if the named
|
||||
profile already exists.
|
||||
|
||||
Please refer to [0] for more details.
|
||||
|
||||
0: http://docs.ceph.com/docs/master/rados/operations/erasure-code-profile/
|
||||
|
||||
@ -1110,6 +1125,11 @@ def create_erasure_profile(service, profile_name,
|
||||
:type erasure_plugin_technique: str
|
||||
:return: None. Can raise CalledProcessError, ValueError or AssertionError
|
||||
"""
|
||||
if erasure_profile_exists(service, profile_name):
|
||||
log('EC profile {} exists, skipping update'.format(profile_name),
|
||||
level=WARNING)
|
||||
return
|
||||
|
||||
plugin_techniques = {
|
||||
'jerasure': [
|
||||
'reed_sol_van',
|
||||
@ -1209,9 +1229,6 @@ def create_erasure_profile(service, profile_name,
|
||||
if scalar_mds:
|
||||
cmd.append('scalar-mds={}'.format(scalar_mds))
|
||||
|
||||
if erasure_profile_exists(service, profile_name):
|
||||
cmd.append('--force')
|
||||
|
||||
check_call(cmd)
|
||||
|
||||
|
||||
@ -2198,6 +2215,7 @@ def send_request_if_needed(request, relation='ceph'):
|
||||
for rid in relation_ids(relation):
|
||||
log('Sending request {}'.format(request.request_id), level=DEBUG)
|
||||
relation_set(relation_id=rid, broker_req=request.request)
|
||||
relation_set(relation_id=rid, relation_settings={'unit-name': local_unit()})
|
||||
|
||||
|
||||
def has_broker_rsp(rid=None, unit=None):
|
||||
|
@ -126,7 +126,6 @@ from charmhelpers.contrib.charmsupport import nrpe
|
||||
|
||||
hooks = Hooks()
|
||||
|
||||
PACKAGES = ['corosync', 'pacemaker', 'python-netaddr', 'ipmitool']
|
||||
COROSYNC_CONF = '/etc/corosync/corosync.conf'
|
||||
COROSYNC_DEFAULT = '/etc/default/corosync'
|
||||
COROSYNC_AUTHKEY = '/etc/corosync/authkey'
|
||||
@ -137,7 +136,7 @@ COROSYNC_CONF_FILES = [
|
||||
COROSYNC_CONF
|
||||
]
|
||||
|
||||
PACKAGES = ['crmsh', 'corosync', 'pacemaker', 'python-netaddr', 'ipmitool',
|
||||
PACKAGES = ['crmsh', 'corosync', 'pacemaker', 'python3-netaddr', 'ipmitool',
|
||||
'libmonitoring-plugin-perl', 'python3-requests-oauthlib']
|
||||
|
||||
SUPPORTED_TRANSPORTS = ['udp', 'udpu', 'multicast', 'unicast']
|
||||
@ -148,12 +147,17 @@ DEPRECATED_TRANSPORT_VALUES = {"multicast": "udp", "unicast": "udpu"}
|
||||
def install():
|
||||
pkgs = copy.deepcopy(PACKAGES)
|
||||
ubuntu_release = lsb_release()['DISTRIB_CODENAME'].lower()
|
||||
# use libnagios on anything older than Xenial
|
||||
if CompareHostReleases(ubuntu_release) < 'xenial':
|
||||
# use libnagios on anything older than Xenial
|
||||
pkgs.remove('libmonitoring-plugin-perl')
|
||||
pkgs.append('libnagios-plugin-perl')
|
||||
|
||||
pkgs.remove('python3-netaddr')
|
||||
pkgs.append('python-netaddr')
|
||||
|
||||
elif CompareHostReleases(ubuntu_release) >= 'bionic':
|
||||
pkgs.append('python3-libmaas')
|
||||
|
||||
# NOTE(dosaboy): we currently disallow upgrades due to bug #1382842. This
|
||||
# should be removed once the pacemaker package is fixed.
|
||||
status_set('maintenance', 'Installing apt packages')
|
||||
|
@ -15,7 +15,6 @@ gate_bundles:
|
||||
- bionic-ussuri
|
||||
- focal-ussuri
|
||||
- focal-victoria
|
||||
dev_bundles:
|
||||
- groovy-victoria
|
||||
|
||||
configure:
|
||||
|
@ -327,7 +327,7 @@ class TestHooks(test_utils.CharmTestCase):
|
||||
'DISTRIB_CODENAME': 'xenial'}
|
||||
filter_installed_packages.side_effect = lambda x: x
|
||||
expected_pkgs = [
|
||||
'crmsh', 'corosync', 'pacemaker', 'python-netaddr', 'ipmitool',
|
||||
'crmsh', 'corosync', 'pacemaker', 'python3-netaddr', 'ipmitool',
|
||||
'libmonitoring-plugin-perl', 'python3-requests-oauthlib']
|
||||
hooks.install()
|
||||
status_set.assert_called_once_with(
|
||||
@ -348,7 +348,7 @@ class TestHooks(test_utils.CharmTestCase):
|
||||
'DISTRIB_CODENAME': 'bionic'}
|
||||
filter_installed_packages.side_effect = lambda x: x
|
||||
expected_pkgs = [
|
||||
'crmsh', 'corosync', 'pacemaker', 'python-netaddr', 'ipmitool',
|
||||
'crmsh', 'corosync', 'pacemaker', 'python3-netaddr', 'ipmitool',
|
||||
'libmonitoring-plugin-perl', 'python3-requests-oauthlib',
|
||||
'python3-libmaas']
|
||||
hooks.install()
|
||||
|
Loading…
Reference in New Issue
Block a user