Pre-release charm-helpers sync 16.10

Get each charm up to date with lp:charm-helpers for release testing.

Change-Id: I88e80453a9649096d913fefaef8c875b4a9ae174
This commit is contained in:
David Ames 2016-09-30 08:53:07 -07:00
parent f11665a912
commit caa6a873bf
9 changed files with 163 additions and 26 deletions

View File

@ -14,6 +14,11 @@
import os import os
from charmhelpers.contrib.network.ip import (
get_address_in_network,
get_iface_addr,
is_ip,
)
from charmhelpers.core.hookenv import ( from charmhelpers.core.hookenv import (
log, log,
DEBUG, DEBUG,
@ -121,6 +126,36 @@ class SSHConfigContext(object):
return cipher[weak_ciphers] return cipher[weak_ciphers]
def get_listening(self, listen=['0.0.0.0']):
"""Returns a list of addresses SSH can list on
Turns input into a sensible list of IPs SSH can listen on. Input
must be a python list of interface names, IPs and/or CIDRs.
:param listen: list of IPs, CIDRs, interface names
:returns: list of IPs available on the host
"""
if listen == ['0.0.0.0']:
return listen
value = []
for network in listen:
try:
ip = get_address_in_network(network=network, fatal=True)
except ValueError:
if is_ip(network):
ip = network
else:
try:
ip = get_iface_addr(iface=network, fatal=False)[0]
except IndexError:
continue
value.append(ip)
if value == []:
return ['0.0.0.0']
return value
def __call__(self): def __call__(self):
settings = utils.get_settings('ssh') settings = utils.get_settings('ssh')
if settings['common']['network_ipv6_enable']: if settings['common']['network_ipv6_enable']:
@ -180,7 +215,7 @@ class SSHDConfigContext(SSHConfigContext):
addr_family = 'inet' addr_family = 'inet'
ctxt = { ctxt = {
'ssh_ip': settings['server']['listen_to'], 'ssh_ip': self.get_listening(settings['server']['listen_to']),
'password_auth_allowed': 'password_auth_allowed':
settings['server']['password_authentication'], settings['server']['password_authentication'],
'ports': settings['common']['ports'], 'ports': settings['common']['ports'],

View File

@ -406,7 +406,7 @@ def is_ip(address):
# Test to see if already an IPv4/IPv6 address # Test to see if already an IPv4/IPv6 address
address = netaddr.IPAddress(address) address = netaddr.IPAddress(address)
return True return True
except netaddr.AddrFormatError: except (netaddr.AddrFormatError, ValueError):
return False return False

View File

@ -98,8 +98,47 @@ class OpenStackAmuletDeployment(AmuletDeployment):
return other_services return other_services
def _add_services(self, this_service, other_services): def _add_services(self, this_service, other_services, use_source=None,
"""Add services to the deployment and set openstack-origin/source.""" no_origin=None):
"""Add services to the deployment and optionally set
openstack-origin/source.
:param this_service dict: Service dictionary describing the service
whose amulet tests are being run
:param other_services dict: List of service dictionaries describing
the services needed to support the target
service
:param use_source list: List of services which use the 'source' config
option rather than 'openstack-origin'
:param no_origin list: List of services which do not support setting
the Cloud Archive.
Service Dict:
{
'name': str charm-name,
'units': int number of units,
'constraints': dict of juju constraints,
'location': str location of charm,
}
eg
this_service = {
'name': 'openvswitch-odl',
'constraints': {'mem': '8G'},
}
other_services = [
{
'name': 'nova-compute',
'units': 2,
'constraints': {'mem': '4G'},
'location': cs:~bob/xenial/nova-compute
},
{
'name': 'mysql',
'constraints': {'mem': '2G'},
},
{'neutron-api-odl'}]
use_source = ['mysql']
no_origin = ['neutron-api-odl']
"""
self.log.info('OpenStackAmuletDeployment: adding services') self.log.info('OpenStackAmuletDeployment: adding services')
other_services = self._determine_branch_locations(other_services) other_services = self._determine_branch_locations(other_services)
@ -110,16 +149,22 @@ class OpenStackAmuletDeployment(AmuletDeployment):
services = other_services services = other_services
services.append(this_service) services.append(this_service)
use_source = use_source or []
no_origin = no_origin or []
# Charms which should use the source config option # Charms which should use the source config option
use_source = ['mysql', 'mongodb', 'rabbitmq-server', 'ceph', use_source = list(set(
'ceph-osd', 'ceph-radosgw', 'ceph-mon', 'ceph-proxy'] use_source + ['mysql', 'mongodb', 'rabbitmq-server', 'ceph',
'ceph-osd', 'ceph-radosgw', 'ceph-mon',
'ceph-proxy']))
# Charms which can not use openstack-origin, ie. many subordinates # Charms which can not use openstack-origin, ie. many subordinates
no_origin = ['cinder-ceph', 'hacluster', 'neutron-openvswitch', 'nrpe', no_origin = list(set(
'openvswitch-odl', 'neutron-api-odl', 'odl-controller', no_origin + ['cinder-ceph', 'hacluster', 'neutron-openvswitch',
'cinder-backup', 'nexentaedge-data', 'nrpe', 'openvswitch-odl', 'neutron-api-odl',
'odl-controller', 'cinder-backup', 'nexentaedge-data',
'nexentaedge-iscsi-gw', 'nexentaedge-swift-gw', 'nexentaedge-iscsi-gw', 'nexentaedge-swift-gw',
'cinder-nexentaedge', 'nexentaedge-mgmt'] 'cinder-nexentaedge', 'nexentaedge-mgmt']))
if self.openstack: if self.openstack:
for svc in services: for svc in services:

View File

@ -1421,9 +1421,9 @@ class InternalEndpointContext(OSContextGenerator):
class AppArmorContext(OSContextGenerator): class AppArmorContext(OSContextGenerator):
"""Base class for apparmor contexts.""" """Base class for apparmor contexts."""
def __init__(self): def __init__(self, profile_name=None):
self._ctxt = None self._ctxt = None
self.aa_profile = None self.aa_profile = profile_name
self.aa_utils_packages = ['apparmor-utils'] self.aa_utils_packages = ['apparmor-utils']
@property @property
@ -1442,6 +1442,8 @@ class AppArmorContext(OSContextGenerator):
if config('aa-profile-mode') in ['disable', 'enforce', 'complain']: if config('aa-profile-mode') in ['disable', 'enforce', 'complain']:
ctxt = {'aa_profile_mode': config('aa-profile-mode'), ctxt = {'aa_profile_mode': config('aa-profile-mode'),
'ubuntu_release': lsb_release()['DISTRIB_RELEASE']} 'ubuntu_release': lsb_release()['DISTRIB_RELEASE']}
if self.aa_profile:
ctxt['aa_profile'] = self.aa_profile
else: else:
ctxt = None ctxt = None
return ctxt return ctxt

View File

@ -30,6 +30,7 @@ from charmhelpers.contrib.hahelpers.cluster import is_clustered
PUBLIC = 'public' PUBLIC = 'public'
INTERNAL = 'int' INTERNAL = 'int'
ADMIN = 'admin' ADMIN = 'admin'
ACCESS = 'access'
ADDRESS_MAP = { ADDRESS_MAP = {
PUBLIC: { PUBLIC: {
@ -49,7 +50,13 @@ ADDRESS_MAP = {
'config': 'os-admin-network', 'config': 'os-admin-network',
'fallback': 'private-address', 'fallback': 'private-address',
'override': 'os-admin-hostname', 'override': 'os-admin-hostname',
} },
ACCESS: {
'binding': 'access',
'config': 'access-network',
'fallback': 'private-address',
'override': 'os-access-hostname',
},
} }

View File

@ -249,6 +249,8 @@ def neutron_plugins():
plugins['nsx']['server_packages'].remove('neutron-plugin-vmware') plugins['nsx']['server_packages'].remove('neutron-plugin-vmware')
plugins['nsx']['server_packages'].append('python-vmware-nsx') plugins['nsx']['server_packages'].append('python-vmware-nsx')
plugins['nsx']['config'] = '/etc/neutron/nsx.ini' plugins['nsx']['config'] = '/etc/neutron/nsx.ini'
plugins['vsp']['driver'] = (
'nuage_neutron.plugins.nuage.plugin.NuagePlugin')
return plugins return plugins

View File

@ -151,7 +151,7 @@ SWIFT_CODENAMES = OrderedDict([
('mitaka', ('mitaka',
['2.5.0', '2.6.0', '2.7.0']), ['2.5.0', '2.6.0', '2.7.0']),
('newton', ('newton',
['2.8.0', '2.9.0']), ['2.8.0', '2.9.0', '2.10.0']),
]) ])
# >= Liberty version->codename mapping # >= Liberty version->codename mapping

View File

@ -47,11 +47,12 @@ def execd_submodule_paths(command, execd_dir=None):
yield path yield path
def execd_run(command, execd_dir=None, die_on_error=False, stderr=None): def execd_run(command, execd_dir=None, die_on_error=True, stderr=subprocess.STDOUT):
"""Run command for each module within execd_dir which defines it.""" """Run command for each module within execd_dir which defines it."""
for submodule_path in execd_submodule_paths(command, execd_dir): for submodule_path in execd_submodule_paths(command, execd_dir):
try: try:
subprocess.check_call(submodule_path, shell=True, stderr=stderr) subprocess.check_output(submodule_path, stderr=stderr,
universal_newlines=True)
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
hookenv.log("Error ({}) running {}. Output: {}".format( hookenv.log("Error ({}) running {}. Output: {}".format(
e.returncode, e.cmd, e.output)) e.returncode, e.cmd, e.output))

View File

@ -98,8 +98,47 @@ class OpenStackAmuletDeployment(AmuletDeployment):
return other_services return other_services
def _add_services(self, this_service, other_services): def _add_services(self, this_service, other_services, use_source=None,
"""Add services to the deployment and set openstack-origin/source.""" no_origin=None):
"""Add services to the deployment and optionally set
openstack-origin/source.
:param this_service dict: Service dictionary describing the service
whose amulet tests are being run
:param other_services dict: List of service dictionaries describing
the services needed to support the target
service
:param use_source list: List of services which use the 'source' config
option rather than 'openstack-origin'
:param no_origin list: List of services which do not support setting
the Cloud Archive.
Service Dict:
{
'name': str charm-name,
'units': int number of units,
'constraints': dict of juju constraints,
'location': str location of charm,
}
eg
this_service = {
'name': 'openvswitch-odl',
'constraints': {'mem': '8G'},
}
other_services = [
{
'name': 'nova-compute',
'units': 2,
'constraints': {'mem': '4G'},
'location': cs:~bob/xenial/nova-compute
},
{
'name': 'mysql',
'constraints': {'mem': '2G'},
},
{'neutron-api-odl'}]
use_source = ['mysql']
no_origin = ['neutron-api-odl']
"""
self.log.info('OpenStackAmuletDeployment: adding services') self.log.info('OpenStackAmuletDeployment: adding services')
other_services = self._determine_branch_locations(other_services) other_services = self._determine_branch_locations(other_services)
@ -110,16 +149,22 @@ class OpenStackAmuletDeployment(AmuletDeployment):
services = other_services services = other_services
services.append(this_service) services.append(this_service)
use_source = use_source or []
no_origin = no_origin or []
# Charms which should use the source config option # Charms which should use the source config option
use_source = ['mysql', 'mongodb', 'rabbitmq-server', 'ceph', use_source = list(set(
'ceph-osd', 'ceph-radosgw', 'ceph-mon', 'ceph-proxy'] use_source + ['mysql', 'mongodb', 'rabbitmq-server', 'ceph',
'ceph-osd', 'ceph-radosgw', 'ceph-mon',
'ceph-proxy']))
# Charms which can not use openstack-origin, ie. many subordinates # Charms which can not use openstack-origin, ie. many subordinates
no_origin = ['cinder-ceph', 'hacluster', 'neutron-openvswitch', 'nrpe', no_origin = list(set(
'openvswitch-odl', 'neutron-api-odl', 'odl-controller', no_origin + ['cinder-ceph', 'hacluster', 'neutron-openvswitch',
'cinder-backup', 'nexentaedge-data', 'nrpe', 'openvswitch-odl', 'neutron-api-odl',
'odl-controller', 'cinder-backup', 'nexentaedge-data',
'nexentaedge-iscsi-gw', 'nexentaedge-swift-gw', 'nexentaedge-iscsi-gw', 'nexentaedge-swift-gw',
'cinder-nexentaedge', 'nexentaedge-mgmt'] 'cinder-nexentaedge', 'nexentaedge-mgmt']))
if self.openstack: if self.openstack:
for svc in services: for svc in services: