Sync charm-helpers
Notable issues resolved: openstack_upgrade_available() broken for swift https://bugs.launchpad.net/charm-swift-proxy/+bug/1743847 haproxy context doesn't consider bindings https://bugs.launchpad.net/charm-helpers/+bug/1735421 regression in haproxy check https://bugs.launchpad.net/charm-helpers/+bug/1743287 * Zesty is EOL Change-Id: I4959507d8925f46295c0eeb90d6a6c9245d9a24a
This commit is contained in:
parent
e588b15cb7
commit
6501423a74
|
@ -93,10 +93,10 @@ from charmhelpers.contrib.network.ip import (
|
||||||
format_ipv6_addr,
|
format_ipv6_addr,
|
||||||
is_bridge_member,
|
is_bridge_member,
|
||||||
is_ipv6_disabled,
|
is_ipv6_disabled,
|
||||||
|
get_relation_ip,
|
||||||
)
|
)
|
||||||
from charmhelpers.contrib.openstack.utils import (
|
from charmhelpers.contrib.openstack.utils import (
|
||||||
config_flags_parser,
|
config_flags_parser,
|
||||||
get_host_ip,
|
|
||||||
git_determine_usr_bin,
|
git_determine_usr_bin,
|
||||||
git_determine_python_path,
|
git_determine_python_path,
|
||||||
enable_memcache,
|
enable_memcache,
|
||||||
|
@ -555,7 +555,9 @@ class HAProxyContext(OSContextGenerator):
|
||||||
"""
|
"""
|
||||||
interfaces = ['cluster']
|
interfaces = ['cluster']
|
||||||
|
|
||||||
def __init__(self, singlenode_mode=False):
|
def __init__(self, singlenode_mode=False,
|
||||||
|
address_types=ADDRESS_TYPES):
|
||||||
|
self.address_types = address_types
|
||||||
self.singlenode_mode = singlenode_mode
|
self.singlenode_mode = singlenode_mode
|
||||||
|
|
||||||
def __call__(self):
|
def __call__(self):
|
||||||
|
@ -564,19 +566,22 @@ class HAProxyContext(OSContextGenerator):
|
||||||
if not relation_ids('cluster') and not self.singlenode_mode:
|
if not relation_ids('cluster') and not self.singlenode_mode:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
if config('prefer-ipv6'):
|
|
||||||
addr = get_ipv6_addr(exc_list=[config('vip')])[0]
|
|
||||||
else:
|
|
||||||
addr = get_host_ip(unit_get('private-address'))
|
|
||||||
|
|
||||||
l_unit = local_unit().replace('/', '-')
|
l_unit = local_unit().replace('/', '-')
|
||||||
cluster_hosts = {}
|
cluster_hosts = {}
|
||||||
|
|
||||||
# NOTE(jamespage): build out map of configured network endpoints
|
# NOTE(jamespage): build out map of configured network endpoints
|
||||||
# and associated backends
|
# and associated backends
|
||||||
for addr_type in ADDRESS_TYPES:
|
for addr_type in self.address_types:
|
||||||
cfg_opt = 'os-{}-network'.format(addr_type)
|
cfg_opt = 'os-{}-network'.format(addr_type)
|
||||||
laddr = get_address_in_network(config(cfg_opt))
|
# NOTE(thedac) For some reason the ADDRESS_MAP uses 'int' rather
|
||||||
|
# than 'internal'
|
||||||
|
if addr_type == 'internal':
|
||||||
|
_addr_map_type = INTERNAL
|
||||||
|
else:
|
||||||
|
_addr_map_type = addr_type
|
||||||
|
# Network spaces aware
|
||||||
|
laddr = get_relation_ip(ADDRESS_MAP[_addr_map_type]['binding'],
|
||||||
|
config(cfg_opt))
|
||||||
if laddr:
|
if laddr:
|
||||||
netmask = get_netmask_for_address(laddr)
|
netmask = get_netmask_for_address(laddr)
|
||||||
cluster_hosts[laddr] = {
|
cluster_hosts[laddr] = {
|
||||||
|
@ -587,15 +592,19 @@ class HAProxyContext(OSContextGenerator):
|
||||||
}
|
}
|
||||||
for rid in relation_ids('cluster'):
|
for rid in relation_ids('cluster'):
|
||||||
for unit in sorted(related_units(rid)):
|
for unit in sorted(related_units(rid)):
|
||||||
|
# API Charms will need to set {addr_type}-address with
|
||||||
|
# get_relation_ip(addr_type)
|
||||||
_laddr = relation_get('{}-address'.format(addr_type),
|
_laddr = relation_get('{}-address'.format(addr_type),
|
||||||
rid=rid, unit=unit)
|
rid=rid, unit=unit)
|
||||||
if _laddr:
|
if _laddr:
|
||||||
_unit = unit.replace('/', '-')
|
_unit = unit.replace('/', '-')
|
||||||
cluster_hosts[laddr]['backends'][_unit] = _laddr
|
cluster_hosts[laddr]['backends'][_unit] = _laddr
|
||||||
|
|
||||||
# NOTE(jamespage) add backend based on private address - this
|
# NOTE(jamespage) add backend based on get_relation_ip - this
|
||||||
# with either be the only backend or the fallback if no acls
|
# will either be the only backend or the fallback if no acls
|
||||||
# match in the frontend
|
# match in the frontend
|
||||||
|
# Network spaces aware
|
||||||
|
addr = get_relation_ip('cluster')
|
||||||
cluster_hosts[addr] = {}
|
cluster_hosts[addr] = {}
|
||||||
netmask = get_netmask_for_address(addr)
|
netmask = get_netmask_for_address(addr)
|
||||||
cluster_hosts[addr] = {
|
cluster_hosts[addr] = {
|
||||||
|
@ -605,6 +614,8 @@ class HAProxyContext(OSContextGenerator):
|
||||||
}
|
}
|
||||||
for rid in relation_ids('cluster'):
|
for rid in relation_ids('cluster'):
|
||||||
for unit in sorted(related_units(rid)):
|
for unit in sorted(related_units(rid)):
|
||||||
|
# API Charms will need to set their private-address with
|
||||||
|
# get_relation_ip('cluster')
|
||||||
_laddr = relation_get('private-address',
|
_laddr = relation_get('private-address',
|
||||||
rid=rid, unit=unit)
|
rid=rid, unit=unit)
|
||||||
if _laddr:
|
if _laddr:
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
CRITICAL=0
|
CRITICAL=0
|
||||||
NOTACTIVE=''
|
NOTACTIVE=''
|
||||||
LOGFILE=/var/log/nagios/check_haproxy.log
|
LOGFILE=/var/log/nagios/check_haproxy.log
|
||||||
AUTH=$(grep -r "stats auth" /etc/haproxy/haproxy.cfg | awk 'NR=1{print $4}')
|
AUTH=$(grep -r "stats auth" /etc/haproxy/haproxy.cfg | awk 'NR=1{print $3}')
|
||||||
|
|
||||||
typeset -i N_INSTANCES=0
|
typeset -i N_INSTANCES=0
|
||||||
for appserver in $(awk '/^\s+server/{print $2}' /etc/haproxy/haproxy.cfg)
|
for appserver in $(awk '/^\s+server/{print $2}' /etc/haproxy/haproxy.cfg)
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
CURRQthrsh=0
|
CURRQthrsh=0
|
||||||
MAXQthrsh=100
|
MAXQthrsh=100
|
||||||
|
|
||||||
AUTH=$(grep -r "stats auth" /etc/haproxy | head -1 | awk '{print $4}')
|
AUTH=$(grep -r "stats auth" /etc/haproxy/haproxy.cfg | awk 'NR=1{print $3}')
|
||||||
|
|
||||||
HAPROXYSTATS=$(/usr/lib/nagios/plugins/check_http -a ${AUTH} -I 127.0.0.1 -p 8888 -u '/;csv' -v)
|
HAPROXYSTATS=$(/usr/lib/nagios/plugins/check_http -a ${AUTH} -I 127.0.0.1 -p 8888 -u '/;csv' -v)
|
||||||
|
|
||||||
|
|
|
@ -654,11 +654,6 @@ def openstack_upgrade_available(package):
|
||||||
else:
|
else:
|
||||||
avail_vers = get_os_version_install_source(src)
|
avail_vers = get_os_version_install_source(src)
|
||||||
apt.init()
|
apt.init()
|
||||||
if "swift" in package:
|
|
||||||
major_cur_vers = cur_vers.split('.', 1)[0]
|
|
||||||
major_avail_vers = avail_vers.split('.', 1)[0]
|
|
||||||
major_diff = apt.version_compare(major_avail_vers, major_cur_vers)
|
|
||||||
return avail_vers > cur_vers and (major_diff == 1 or major_diff == 0)
|
|
||||||
return apt.version_compare(avail_vers, cur_vers) == 1
|
return apt.version_compare(avail_vers, cur_vers) == 1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -377,12 +377,12 @@ def get_mon_map(service):
|
||||||
try:
|
try:
|
||||||
return json.loads(mon_status)
|
return json.loads(mon_status)
|
||||||
except ValueError as v:
|
except ValueError as v:
|
||||||
log("Unable to parse mon_status json: {}. Error: {}"
|
log("Unable to parse mon_status json: {}. Error: {}".format(
|
||||||
.format(mon_status, str(v)))
|
mon_status, v.message))
|
||||||
raise
|
raise
|
||||||
except CalledProcessError as e:
|
except CalledProcessError as e:
|
||||||
log("mon_status command failed with message: {}"
|
log("mon_status command failed with message: {}".format(
|
||||||
.format(str(e)))
|
e.message))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ if not six.PY3:
|
||||||
else:
|
else:
|
||||||
from collections import UserDict
|
from collections import UserDict
|
||||||
|
|
||||||
|
|
||||||
CRITICAL = "CRITICAL"
|
CRITICAL = "CRITICAL"
|
||||||
ERROR = "ERROR"
|
ERROR = "ERROR"
|
||||||
WARNING = "WARNING"
|
WARNING = "WARNING"
|
||||||
|
@ -344,6 +345,7 @@ class Config(dict):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
with open(self.path, 'w') as f:
|
with open(self.path, 'w') as f:
|
||||||
|
os.fchmod(f.fileno(), 0o600)
|
||||||
json.dump(self, f)
|
json.dump(self, f)
|
||||||
|
|
||||||
def _implicit_save(self):
|
def _implicit_save(self):
|
||||||
|
|
|
@ -175,6 +175,8 @@ class Storage(object):
|
||||||
else:
|
else:
|
||||||
self.db_path = os.path.join(
|
self.db_path = os.path.join(
|
||||||
os.environ.get('CHARM_DIR', ''), '.unit-state.db')
|
os.environ.get('CHARM_DIR', ''), '.unit-state.db')
|
||||||
|
with open(self.db_path, 'a') as f:
|
||||||
|
os.fchmod(f.fileno(), 0o600)
|
||||||
self.conn = sqlite3.connect('%s' % self.db_path)
|
self.conn = sqlite3.connect('%s' % self.db_path)
|
||||||
self.cursor = self.conn.cursor()
|
self.cursor = self.conn.cursor()
|
||||||
self.revision = None
|
self.revision = None
|
||||||
|
|
|
@ -18,7 +18,6 @@ tags:
|
||||||
series:
|
series:
|
||||||
- xenial
|
- xenial
|
||||||
- artful
|
- artful
|
||||||
- zesty
|
|
||||||
- trusty
|
- trusty
|
||||||
extra-bindings:
|
extra-bindings:
|
||||||
data:
|
data:
|
||||||
|
|
|
@ -379,7 +379,7 @@ class NeutronGatewayBasicDeployment(OpenStackAmuletDeployment):
|
||||||
expected['service_username'] = 'nova'
|
expected['service_username'] = 'nova'
|
||||||
else:
|
else:
|
||||||
# Juno or earlier
|
# Juno or earlier
|
||||||
expected['service_username'] = 's3_ec2_nova'
|
expected['service_username'] = 's3_nova_ec2'
|
||||||
|
|
||||||
ret = u.validate_relation_data(unit, relation, expected)
|
ret = u.validate_relation_data(unit, relation, expected)
|
||||||
if ret:
|
if ret:
|
||||||
|
|
|
@ -654,11 +654,6 @@ def openstack_upgrade_available(package):
|
||||||
else:
|
else:
|
||||||
avail_vers = get_os_version_install_source(src)
|
avail_vers = get_os_version_install_source(src)
|
||||||
apt.init()
|
apt.init()
|
||||||
if "swift" in package:
|
|
||||||
major_cur_vers = cur_vers.split('.', 1)[0]
|
|
||||||
major_avail_vers = avail_vers.split('.', 1)[0]
|
|
||||||
major_diff = apt.version_compare(major_avail_vers, major_cur_vers)
|
|
||||||
return avail_vers > cur_vers and (major_diff == 1 or major_diff == 0)
|
|
||||||
return apt.version_compare(avail_vers, cur_vers) == 1
|
return apt.version_compare(avail_vers, cur_vers) == 1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -377,12 +377,12 @@ def get_mon_map(service):
|
||||||
try:
|
try:
|
||||||
return json.loads(mon_status)
|
return json.loads(mon_status)
|
||||||
except ValueError as v:
|
except ValueError as v:
|
||||||
log("Unable to parse mon_status json: {}. Error: {}"
|
log("Unable to parse mon_status json: {}. Error: {}".format(
|
||||||
.format(mon_status, str(v)))
|
mon_status, v.message))
|
||||||
raise
|
raise
|
||||||
except CalledProcessError as e:
|
except CalledProcessError as e:
|
||||||
log("mon_status command failed with message: {}"
|
log("mon_status command failed with message: {}".format(
|
||||||
.format(str(e)))
|
e.message))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ if not six.PY3:
|
||||||
else:
|
else:
|
||||||
from collections import UserDict
|
from collections import UserDict
|
||||||
|
|
||||||
|
|
||||||
CRITICAL = "CRITICAL"
|
CRITICAL = "CRITICAL"
|
||||||
ERROR = "ERROR"
|
ERROR = "ERROR"
|
||||||
WARNING = "WARNING"
|
WARNING = "WARNING"
|
||||||
|
@ -344,6 +345,7 @@ class Config(dict):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
with open(self.path, 'w') as f:
|
with open(self.path, 'w') as f:
|
||||||
|
os.fchmod(f.fileno(), 0o600)
|
||||||
json.dump(self, f)
|
json.dump(self, f)
|
||||||
|
|
||||||
def _implicit_save(self):
|
def _implicit_save(self):
|
||||||
|
|
|
@ -175,6 +175,8 @@ class Storage(object):
|
||||||
else:
|
else:
|
||||||
self.db_path = os.path.join(
|
self.db_path = os.path.join(
|
||||||
os.environ.get('CHARM_DIR', ''), '.unit-state.db')
|
os.environ.get('CHARM_DIR', ''), '.unit-state.db')
|
||||||
|
with open(self.db_path, 'a') as f:
|
||||||
|
os.fchmod(f.fileno(), 0o600)
|
||||||
self.conn = sqlite3.connect('%s' % self.db_path)
|
self.conn = sqlite3.connect('%s' % self.db_path)
|
||||||
self.cursor = self.conn.cursor()
|
self.cursor = self.conn.cursor()
|
||||||
self.revision = None
|
self.revision = None
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
"""Amulet tests on a basic quantum-gateway deployment on zesty-ocata."""
|
|
||||||
|
|
||||||
from basic_deployment import NeutronGatewayBasicDeployment
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
deployment = NeutronGatewayBasicDeployment(series='zesty')
|
|
||||||
deployment.run_tests()
|
|
Loading…
Reference in New Issue