Ensure context templating doesn't fail on incomplete relation data
This is a rebuild/make sync for charms to pickup the fix in charmhelpers to fix a change in netaddr library not allowing falsy addresses anymore. Fix in charmhelpers is in [1]. [1] https://github.com/juju/charm-helpers/pull/921 Change-Id: I0b8adad3dd0162e5dcd58704f2e12ee1955ee52f Signed-off-by: Guillaume Boutry <guillaume.boutry@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:
|
||||||
|
@@ -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:
|
||||||
|
@@ -341,7 +341,7 @@ UBUNTU_OPENSTACK_RELEASE = OrderedDict([
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
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 +464,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 +1023,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