Updates for testing period for 20.01 release
Includes updates to charmhelpers/charms.openstack for cert_utils and unit-get for the install hook error on Juju 2.9 * charm-helpers sync for classic charms * rebuild for reactive charms * ensure tox.ini is from release-tools * ensure requirements.txt files are from release-tools * On reactive charms: - ensure master branch for charms.openstack - ensure master branch for charm-helpers Change-Id: I9b82fbd56bd64fa758dd069b984ba12ec6f6ce34
This commit is contained in:
parent
e4457aa89a
commit
772013e6b8
@ -30,7 +30,6 @@ from charmhelpers.core.hookenv import (
|
|||||||
relation_get,
|
relation_get,
|
||||||
relation_ids,
|
relation_ids,
|
||||||
remote_service_name,
|
remote_service_name,
|
||||||
unit_get,
|
|
||||||
NoNetworkBinding,
|
NoNetworkBinding,
|
||||||
log,
|
log,
|
||||||
WARNING,
|
WARNING,
|
||||||
@ -41,6 +40,7 @@ from charmhelpers.contrib.openstack.ip import (
|
|||||||
get_vip_in_network,
|
get_vip_in_network,
|
||||||
ADDRESS_MAP,
|
ADDRESS_MAP,
|
||||||
get_default_api_bindings,
|
get_default_api_bindings,
|
||||||
|
local_address,
|
||||||
)
|
)
|
||||||
from charmhelpers.contrib.network.ip import (
|
from charmhelpers.contrib.network.ip import (
|
||||||
get_relation_ip,
|
get_relation_ip,
|
||||||
@ -81,7 +81,7 @@ class CertRequest(object):
|
|||||||
|
|
||||||
def add_hostname_cn(self):
|
def add_hostname_cn(self):
|
||||||
"""Add a request for the hostname of the machine"""
|
"""Add a request for the hostname of the machine"""
|
||||||
ip = unit_get('private-address')
|
ip = local_address(unit_get_fallback='private-address')
|
||||||
addresses = [ip]
|
addresses = [ip]
|
||||||
# If a vip is being used without os-hostname config or
|
# If a vip is being used without os-hostname config or
|
||||||
# network spaces then we need to ensure the local units
|
# network spaces then we need to ensure the local units
|
||||||
@ -194,7 +194,7 @@ def get_certificate_sans(bindings=None):
|
|||||||
:returns: List of binding string names
|
:returns: List of binding string names
|
||||||
:rtype: List[str]
|
:rtype: List[str]
|
||||||
"""
|
"""
|
||||||
_sans = [unit_get('private-address')]
|
_sans = [local_address(unit_get_fallback='private-address')]
|
||||||
if bindings:
|
if bindings:
|
||||||
# Add default API bindings to bindings list
|
# Add default API bindings to bindings list
|
||||||
bindings = list(bindings + get_default_api_bindings())
|
bindings = list(bindings + get_default_api_bindings())
|
||||||
@ -260,7 +260,7 @@ def create_ip_cert_links(ssl_dir, custom_hostname_link=None, bindings=None):
|
|||||||
os.symlink(requested_key, key)
|
os.symlink(requested_key, key)
|
||||||
|
|
||||||
# Handle custom hostnames
|
# Handle custom hostnames
|
||||||
hostname = get_hostname(unit_get('private-address'))
|
hostname = get_hostname(local_address(unit_get_fallback='private-address'))
|
||||||
hostname_cert = os.path.join(
|
hostname_cert = os.path.join(
|
||||||
ssl_dir,
|
ssl_dir,
|
||||||
'cert_{}'.format(hostname))
|
'cert_{}'.format(hostname))
|
||||||
|
@ -49,7 +49,6 @@ from charmhelpers.core.hookenv import (
|
|||||||
relation_ids,
|
relation_ids,
|
||||||
related_units,
|
related_units,
|
||||||
relation_set,
|
relation_set,
|
||||||
unit_get,
|
|
||||||
unit_private_ip,
|
unit_private_ip,
|
||||||
charm_name,
|
charm_name,
|
||||||
DEBUG,
|
DEBUG,
|
||||||
@ -98,6 +97,7 @@ from charmhelpers.contrib.openstack.ip import (
|
|||||||
ADMIN,
|
ADMIN,
|
||||||
PUBLIC,
|
PUBLIC,
|
||||||
ADDRESS_MAP,
|
ADDRESS_MAP,
|
||||||
|
local_address,
|
||||||
)
|
)
|
||||||
from charmhelpers.contrib.network.ip import (
|
from charmhelpers.contrib.network.ip import (
|
||||||
get_address_in_network,
|
get_address_in_network,
|
||||||
@ -247,7 +247,7 @@ class SharedDBContext(OSContextGenerator):
|
|||||||
hostname_key = "hostname"
|
hostname_key = "hostname"
|
||||||
access_hostname = get_address_in_network(
|
access_hostname = get_address_in_network(
|
||||||
access_network,
|
access_network,
|
||||||
unit_get('private-address'))
|
local_address(unit_get_fallback='private-address'))
|
||||||
set_hostname = relation_get(attribute=hostname_key,
|
set_hostname = relation_get(attribute=hostname_key,
|
||||||
unit=local_unit())
|
unit=local_unit())
|
||||||
if set_hostname != access_hostname:
|
if set_hostname != access_hostname:
|
||||||
@ -1088,7 +1088,7 @@ class ApacheSSLContext(OSContextGenerator):
|
|||||||
# NOTE(jamespage): Fallback must always be private address
|
# NOTE(jamespage): Fallback must always be private address
|
||||||
# as this is used to bind services on the
|
# as this is used to bind services on the
|
||||||
# local unit.
|
# local unit.
|
||||||
fallback = unit_get("private-address")
|
fallback = local_address(unit_get_fallback="private-address")
|
||||||
if net_config:
|
if net_config:
|
||||||
addr = get_address_in_network(net_config,
|
addr = get_address_in_network(net_config,
|
||||||
fallback)
|
fallback)
|
||||||
@ -1260,7 +1260,7 @@ class NeutronContext(OSContextGenerator):
|
|||||||
if is_clustered():
|
if is_clustered():
|
||||||
host = config('vip')
|
host = config('vip')
|
||||||
else:
|
else:
|
||||||
host = unit_get('private-address')
|
host = local_address(unit_get_fallback='private-address')
|
||||||
|
|
||||||
ctxt = {'network_manager': self.network_manager,
|
ctxt = {'network_manager': self.network_manager,
|
||||||
'neutron_url': '%s://%s:%s' % (proto, host, '9696')}
|
'neutron_url': '%s://%s:%s' % (proto, host, '9696')}
|
||||||
|
@ -123,6 +123,25 @@ def _get_address_override(endpoint_type=PUBLIC):
|
|||||||
return addr_override.format(service_name=service_name())
|
return addr_override.format(service_name=service_name())
|
||||||
|
|
||||||
|
|
||||||
|
def local_address(unit_get_fallback='public-address'):
|
||||||
|
"""Return a network address for this unit.
|
||||||
|
|
||||||
|
Attempt to retrieve a 'default' IP address for this unit
|
||||||
|
from network-get. If this is running with an old version of Juju then
|
||||||
|
fallback to unit_get.
|
||||||
|
|
||||||
|
:param unit_get_fallback: Either 'public-address' or 'private-address'.
|
||||||
|
Only used with old versions of Juju.
|
||||||
|
:type unit_get_fallback: str
|
||||||
|
:returns: IP Address
|
||||||
|
:rtype: str
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
return network_get_primary_address('juju-info')
|
||||||
|
except NotImplementedError:
|
||||||
|
return unit_get(unit_get_fallback)
|
||||||
|
|
||||||
|
|
||||||
def resolve_address(endpoint_type=PUBLIC, override=True):
|
def resolve_address(endpoint_type=PUBLIC, override=True):
|
||||||
"""Return unit address depending on net config.
|
"""Return unit address depending on net config.
|
||||||
|
|
||||||
@ -176,7 +195,7 @@ def resolve_address(endpoint_type=PUBLIC, override=True):
|
|||||||
if config('prefer-ipv6'):
|
if config('prefer-ipv6'):
|
||||||
fallback_addr = get_ipv6_addr(exc_list=vips)[0]
|
fallback_addr = get_ipv6_addr(exc_list=vips)[0]
|
||||||
else:
|
else:
|
||||||
fallback_addr = unit_get(net_fallback)
|
fallback_addr = local_address(unit_get_fallback=net_fallback)
|
||||||
|
|
||||||
if net_addr:
|
if net_addr:
|
||||||
resolved_address = get_address_in_network(net_addr, fallback_addr)
|
resolved_address = get_address_in_network(net_addr, fallback_addr)
|
||||||
|
Loading…
Reference in New Issue
Block a user