~loki-8/cloud-init:fix/1792454-netork-configuration-v2-and-translate_network

Last commit made on 2018-09-14
Get this branch:
git clone -b fix/1792454-netork-configuration-v2-and-translate_network https://git.launchpad.net/~loki-8/cloud-init
Only Thomas Berger can upload to this branch. If you are Thomas Berger please log in for upload directions.

Branch merges

Branch information

Name:
fix/1792454-netork-configuration-v2-and-translate_network
Repository:
lp:~loki-8/cloud-init

Recent commits

115a244... by Thomas Berger

net_util: ensure static configs have netmask in translate_network result

If a DataSource provides a network configuration in version 2 and runs
on a distro which does not have a network renderer class in use, then
the conversion of V2 to eni results in static ip configurations with
subnet prefix-length (192.168.23.1/24) rather than explicit netmask
value.

When sending such a config to net_util.translate_network the resulting
dictionary is missing the 'netmask' key for static configured addresses
breaking network configurations on multiple distributions.

This patch detects static ip configurations using prefix-length and
converts the format into the previous 'address' and 'netmask' parts
to keep compatibility for these distribtuions until they move to
the v2 network configuration.

LP: #1792454

4361e0e... by Scott Moser

OpenStack: support reading of newer versions of metdata.

Mark as supported for reading some newer versions of openstack metadata:
 2016-06-30 : Newton one
 2016-10-06 : Newton two
 2017-02-22 : Ocata
 2018-08-27 : Rocky

c75c582... by Scott Moser

OpenStack: fix bug causing 'latest' version to be used from network.

Cloud-init was reading a list of versions from the OpenStack metadata
service (http://169.254.169.254/openstack/) and attempt to select the
newest known supported version. The problem was that the list
of versions was not being decoded, so we were comparing a list of
bytes (found versions) to a list of strings (known versions).

LP: #1792157

c755576... by Chad Smith

user-data: jinja template to render instance-data.json in cloud-config

Allow users to provide '## template: jinja' as the first line or their
#cloud-config or custom script user-data parts. When this header exists,
the cloud-config or script will be rendered as a jinja template.

All instance metadata keys and values present in
/run/cloud-init/instance-data.json will be available as jinja variables
for the template. This means any cloud-config module or script can
reference any standardized instance data in templates and scripts.

Additionally, any standardized instance-data.json keys scoped below a
'<v#>' key will be promoted as a top-level key for ease of reference in
templates. This means that '{{ local_hostname }}' is the same as using the
latest '{{ v#.local_hostname }}'.

Since instance-data is written to /run/cloud-init/instance-data.json, make
sure it is persisted across reboots when the cached datasource opject is
reloaded.

LP: #1791781

757247f... by Chad Smith

config: disable ssh access to a configured user account

Cloud config can now disable ssh access to non-root users.

When defining the 'users' list in cloud-configuration a boolean
'ssh_redirect_user: true' can be provided to disable ssh logins for
that user. Any ssh 'public-keys' defined in cloud meta-data will be added
and disabled in .ssh/authorized_keys. Any attempts to ssh as this user
using acceptable ssh keys will be presented with a message like the
following:

Please login as the user "ubuntu" rather than the user "youruser".

d47d404... by Chad Smith

tests: print failed testname instead of docstring upon failure

a8dcad9... by Scott Moser

tests: Disallow use of util.subp except for where needed.

In many cases, cloud-init uses 'util.subp' to run a subprocess.
This is not really desirable in our unit tests as it makes the tests
dependent upon existance of those utilities.

The change here is to modify the base test case class (CiTestCase) to
raise exception any time subp is called. Then, fix all callers.
For cases where subp is necessary or actually desired, we can use it
via
  a.) context hander CiTestCase.allow_subp(value)
  b.) class level self.allowed_subp = value

Both cases the value is a list of acceptable executable names that
will be called (essentially argv[0]).

Some cleanups in AltCloud were done as the code was being updated.

db50bc0... by Ryan Harper

sysconfig: refactor sysconfig to accept distro specific templates paths

Multiple distros use sysconfig format but have different content
and paths to certain files. Update distros to specify these
template paths in their renderer_configs dictionary.

3f6d097... by Francis Ginther

Add unit tests for config/cc_ssh.py

These tests focus on the apply_credentials method and the ssh setup for
root and a distro default user.

2d0ca72... by Scott Moser

Fix the built-in cloudinit/tests/helpers:skipIf

this version uses unittest2 skipIf which is present in our python 2.6
environment.