Sync charmhelpers
Refresh charmhelpers with the latest Flamingo/Gazpacho version metadata. Change-Id: I117c7697066c770ceef3a01fa4efcdba3f2af8ad Signed-off-by: Myles Penner <myles.penner@canonical.com>
This commit is contained in:
@@ -134,6 +134,8 @@ def get_address_in_network(network, fallback=None, fatal=False):
|
|||||||
|
|
||||||
def is_ipv6(address):
|
def is_ipv6(address):
|
||||||
"""Determine whether provided address is IPv6 or not."""
|
"""Determine whether provided address is IPv6 or not."""
|
||||||
|
if not address:
|
||||||
|
return False
|
||||||
try:
|
try:
|
||||||
address = netaddr.IPAddress(address)
|
address = netaddr.IPAddress(address)
|
||||||
except netaddr.AddrFormatError:
|
except netaddr.AddrFormatError:
|
||||||
@@ -467,9 +469,21 @@ def ns_query(address):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
answers = dns.resolver.query(address, rtype)
|
resolv = dns.resolver.Resolver()
|
||||||
|
# The dnspython library sets a default DNS query lifetime of 5.0 seconds,
|
||||||
|
# as defined in BaseResolver.reset() (see https://github.com/rthalley/
|
||||||
|
# dnspython/blob/7ed1648b/dns/resolver.py#L709, commit 7ed1648b).
|
||||||
|
resolv.lifetime = config('dns-query-timeout') or 5.0
|
||||||
|
if hasattr(resolv, 'resolve'):
|
||||||
|
answers = resolv.resolve(address, rtype)
|
||||||
|
else:
|
||||||
|
answers = resolv.query(address, rtype)
|
||||||
except (dns.resolver.NXDOMAIN, dns.resolver.NoNameservers):
|
except (dns.resolver.NXDOMAIN, dns.resolver.NoNameservers):
|
||||||
return None
|
return None
|
||||||
|
except dns.exception.Timeout:
|
||||||
|
log("DNS query timed out for address {} with rtype {} and timeout "
|
||||||
|
"{}".format(address, rtype, resolv.lifetime), level=WARNING)
|
||||||
|
return None
|
||||||
|
|
||||||
if answers:
|
if answers:
|
||||||
return str(answers[0])
|
return str(answers[0])
|
||||||
@@ -618,7 +632,7 @@ def get_relation_ip(interface, cidr_network=None):
|
|||||||
# Currently IPv6 has priority, eventually we want IPv6 to just be
|
# Currently IPv6 has priority, eventually we want IPv6 to just be
|
||||||
# another network space.
|
# another network space.
|
||||||
assert_charm_supports_ipv6()
|
assert_charm_supports_ipv6()
|
||||||
return get_ipv6_addr()[0]
|
return get_ipv6_addr(dynamic_only=False)[0]
|
||||||
elif cidr_network:
|
elif cidr_network:
|
||||||
# If a specific CIDR network is passed get the address from that
|
# If a specific CIDR network is passed get the address from that
|
||||||
# network.
|
# network.
|
||||||
|
|||||||
@@ -25,7 +25,10 @@ import socket
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
from base64 import b64decode
|
from base64 import b64decode
|
||||||
from distutils.version import LooseVersion
|
try:
|
||||||
|
from distutils.version import LooseVersion
|
||||||
|
except ImportError:
|
||||||
|
from looseversion import LooseVersion
|
||||||
from subprocess import (
|
from subprocess import (
|
||||||
check_call,
|
check_call,
|
||||||
check_output,
|
check_output,
|
||||||
|
|||||||
@@ -164,6 +164,8 @@ OPENSTACK_CODENAMES = OrderedDict([
|
|||||||
('2024.1', 'caracal'),
|
('2024.1', 'caracal'),
|
||||||
('2024.2', 'dalmatian'),
|
('2024.2', 'dalmatian'),
|
||||||
('2025.1', 'epoxy'),
|
('2025.1', 'epoxy'),
|
||||||
|
('2025.2', 'flamingo'),
|
||||||
|
('2026.1', 'gazpacho'),
|
||||||
])
|
])
|
||||||
|
|
||||||
# The ugly duckling - must list releases oldest to newest
|
# The ugly duckling - must list releases oldest to newest
|
||||||
|
|||||||
@@ -357,7 +357,7 @@ def init_is_systemd(service_name=None):
|
|||||||
return os.path.isdir(SYSTEMD_SYSTEM)
|
return os.path.isdir(SYSTEMD_SYSTEM)
|
||||||
|
|
||||||
|
|
||||||
def adduser(username, password=None, shell='/bin/bash',
|
def adduser(username, password=None, shell=None,
|
||||||
system_user=False, primary_group=None,
|
system_user=False, primary_group=None,
|
||||||
secondary_groups=None, uid=None, home_dir=None):
|
secondary_groups=None, uid=None, home_dir=None):
|
||||||
"""Add a user to the system.
|
"""Add a user to the system.
|
||||||
@@ -389,11 +389,14 @@ def adduser(username, password=None, shell='/bin/bash',
|
|||||||
if home_dir:
|
if home_dir:
|
||||||
cmd.extend(['--home', str(home_dir)])
|
cmd.extend(['--home', str(home_dir)])
|
||||||
if system_user or password is None:
|
if system_user or password is None:
|
||||||
cmd.append('--system')
|
cmd.extend([
|
||||||
|
'--system',
|
||||||
|
'--shell', shell if shell else '/usr/sbin/nologin'
|
||||||
|
])
|
||||||
else:
|
else:
|
||||||
cmd.extend([
|
cmd.extend([
|
||||||
'--create-home',
|
'--create-home',
|
||||||
'--shell', shell,
|
'--shell', shell if shell else '/bin/bash',
|
||||||
'--password', password,
|
'--password', password,
|
||||||
])
|
])
|
||||||
if not primary_group:
|
if not primary_group:
|
||||||
|
|||||||
@@ -270,6 +270,22 @@ CLOUD_ARCHIVE_POCKETS = {
|
|||||||
'epoxy/proposed': 'noble-proposed/epoxy',
|
'epoxy/proposed': 'noble-proposed/epoxy',
|
||||||
'noble-epoxy/proposed': 'noble-proposed/epoxy',
|
'noble-epoxy/proposed': 'noble-proposed/epoxy',
|
||||||
'noble-proposed/epoxy': 'noble-proposed/epoxy',
|
'noble-proposed/epoxy': 'noble-proposed/epoxy',
|
||||||
|
# flamingo
|
||||||
|
'flamingo': 'noble-updates/flamingo',
|
||||||
|
'noble-flamingo': 'noble-updates/flamingo',
|
||||||
|
'noble-flamingo/updates': 'noble-updates/flamingo',
|
||||||
|
'noble-updates/flamingo': 'noble-updates/flamingo',
|
||||||
|
'flamingo/proposed': 'noble-proposed/flamingo',
|
||||||
|
'noble-flamingo/proposed': 'noble-proposed/flamingo',
|
||||||
|
'noble-proposed/flamingo': 'noble-proposed/flamingo',
|
||||||
|
# gazpacho
|
||||||
|
'gazpacho': 'noble-updates/gazpacho',
|
||||||
|
'noble-gazpacho': 'noble-updates/gazpacho',
|
||||||
|
'noble-gazpacho/updates': 'noble-updates/gazpacho',
|
||||||
|
'noble-updates/gazpacho': 'noble-updates/gazpacho',
|
||||||
|
'gazpacho/proposed': 'noble-proposed/gazpacho',
|
||||||
|
'noble-gazpacho/proposed': 'noble-proposed/gazpacho',
|
||||||
|
'noble-proposed/gazpacho': 'noble-proposed/gazpacho',
|
||||||
|
|
||||||
# OVN
|
# OVN
|
||||||
'focal-ovn-22.03': 'focal-updates/ovn-22.03',
|
'focal-ovn-22.03': 'focal-updates/ovn-22.03',
|
||||||
@@ -306,6 +322,8 @@ OPENSTACK_RELEASES = (
|
|||||||
'caracal',
|
'caracal',
|
||||||
'dalmatian',
|
'dalmatian',
|
||||||
'epoxy',
|
'epoxy',
|
||||||
|
'flamingo',
|
||||||
|
'gazpacho',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -338,10 +356,12 @@ UBUNTU_OPENSTACK_RELEASE = OrderedDict([
|
|||||||
('noble', 'caracal'),
|
('noble', 'caracal'),
|
||||||
('oracular', 'dalmatian'),
|
('oracular', 'dalmatian'),
|
||||||
('plucky', 'epoxy'),
|
('plucky', 'epoxy'),
|
||||||
|
('questing', 'flamingo'),
|
||||||
|
('resolute', 'gazpacho'),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
APT_NO_LOCK = 100 # The return code for "couldn't acquire lock" in APT.
|
APT_ERROR_CODE = 100 # The return code for APT errors.
|
||||||
CMD_RETRY_DELAY = 10 # Wait 10 seconds between command retries.
|
CMD_RETRY_DELAY = 10 # Wait 10 seconds between command retries.
|
||||||
CMD_RETRY_COUNT = 10 # Retry a failing fatal command X times.
|
CMD_RETRY_COUNT = 10 # Retry a failing fatal command X times.
|
||||||
|
|
||||||
@@ -464,6 +484,8 @@ def apt_upgrade(options=None, fatal=False, dist=False):
|
|||||||
def apt_update(fatal=False):
|
def apt_update(fatal=False):
|
||||||
"""Update local apt cache."""
|
"""Update local apt cache."""
|
||||||
cmd = ['apt-get', 'update']
|
cmd = ['apt-get', 'update']
|
||||||
|
if fatal:
|
||||||
|
cmd.append("--error-on=any")
|
||||||
_run_apt_command(cmd, fatal)
|
_run_apt_command(cmd, fatal)
|
||||||
|
|
||||||
|
|
||||||
@@ -1021,8 +1043,7 @@ def _run_apt_command(cmd, fatal=False, quiet=False):
|
|||||||
"""
|
"""
|
||||||
if fatal:
|
if fatal:
|
||||||
_run_with_retries(
|
_run_with_retries(
|
||||||
cmd, retry_exitcodes=(1, APT_NO_LOCK,),
|
cmd, retry_exitcodes=(1, APT_ERROR_CODE,),
|
||||||
retry_message="Couldn't acquire DPKG lock",
|
|
||||||
quiet=quiet)
|
quiet=quiet)
|
||||||
else:
|
else:
|
||||||
kwargs = {}
|
kwargs = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user