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: Ie347a1adf7f971f7860e774f0c3cab5974a17c25 Signed-off-by: Guillaume Boutry <guillaume.boutry@canonical.com>
This commit is contained in:
parent
1b671e798a
commit
ac8b75857e
@ -134,6 +134,8 @@ def get_address_in_network(network, fallback=None, fatal=False):
|
||||
|
||||
def is_ipv6(address):
|
||||
"""Determine whether provided address is IPv6 or not."""
|
||||
if not address:
|
||||
return False
|
||||
try:
|
||||
address = netaddr.IPAddress(address)
|
||||
except netaddr.AddrFormatError:
|
||||
|
@ -357,7 +357,7 @@ def init_is_systemd(service_name=None):
|
||||
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,
|
||||
secondary_groups=None, uid=None, home_dir=None):
|
||||
"""Add a user to the system.
|
||||
@ -389,11 +389,14 @@ def adduser(username, password=None, shell='/bin/bash',
|
||||
if home_dir:
|
||||
cmd.extend(['--home', str(home_dir)])
|
||||
if system_user or password is None:
|
||||
cmd.append('--system')
|
||||
cmd.extend([
|
||||
'--system',
|
||||
'--shell', shell if shell else '/usr/sbin/nologin'
|
||||
])
|
||||
else:
|
||||
cmd.extend([
|
||||
'--create-home',
|
||||
'--shell', shell,
|
||||
'--shell', shell if shell else '/bin/bash',
|
||||
'--password', password,
|
||||
])
|
||||
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_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):
|
||||
"""Update local apt cache."""
|
||||
cmd = ['apt-get', 'update']
|
||||
if fatal:
|
||||
cmd.append("--error-on=any")
|
||||
_run_apt_command(cmd, fatal)
|
||||
|
||||
|
||||
@ -1021,8 +1023,7 @@ def _run_apt_command(cmd, fatal=False, quiet=False):
|
||||
"""
|
||||
if fatal:
|
||||
_run_with_retries(
|
||||
cmd, retry_exitcodes=(1, APT_NO_LOCK,),
|
||||
retry_message="Couldn't acquire DPKG lock",
|
||||
cmd, retry_exitcodes=(1, APT_ERROR_CODE,),
|
||||
quiet=quiet)
|
||||
else:
|
||||
kwargs = {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user