~larsks/cloud-init:bug/preserve-sysconfig-network

Last commit made on 2018-04-22
Get this branch:
git clone -b bug/preserve-sysconfig-network https://git.launchpad.net/~larsks/cloud-init
Only Lars Kellogg-Stedman can upload to this branch. If you are Lars Kellogg-Stedman please log in for upload directions.

Branch merges

Branch information

Name:
bug/preserve-sysconfig-network
Repository:
lp:~larsks/cloud-init

Recent commits

d8bde77... by Lars Kellogg-Stedman

Retain existing values in /etc/sysconfig/network

cloud-init was replacing /etc/sysconfig/network without respecting any
existing configuration in that file.

53f3f55... by Junjie.Wang

doc: Add documentation for AliYun datasource.

Just add some documentation to readthedocs for AliYun.

6811926... by Scott Moser

Schema: do not warn on duplicate items in commands.

runcmd, bootcmd, snap/commands, ubuntu-advantage/commands would
log warning (and fail if strict) on duplicate values in the commands.
But those should be allowed. Example, it is perfectly valid to do:
   runcmd: ['sleep 1', 'sleep 1']

LP: #1764264

6d48d26... by Chad Smith

net: Depend on iproute2's ip instead of net-tools ifconfig or route

The net-tools package is deprecated and will eventually be dropped. Use
"ip route", "link" or "address" instead of "ifconfig" or "route" calls.
Cloud-init can now run in an environment that no longer has net-tools.
This affects the network and route printing emitted to
cloud-config-output.log as well as the cc_disable_ec2_metadata module.

Additional changes:
 - separate readResource and resourceLocation into standalone test
   functions
 - Fix ipv4 address rows to report scopes represented by ip addr show
 - Formatted route/address ouput now handles multiple ipv4 and ipv6
   addresses on a single interface

Co-authored-by: James Hogarth <email address hidden>
Co-authored-by: Robert Schweikert <email address hidden>

4c573d0... by Mike Gerdts

DataSourceSmartOS: fix hang when metadata service is down

If the metadata service in the host is down while a guest that uses
DataSourceSmartOS is booting, the request from the guest falls into the
bit bucket. When the metadata service is eventually started, the guest
has no awareness of this and does not resend the request. This results in
cloud-init hanging forever with a guest reboot as the only recovery
option.

This fix updates the metadata protocol to implement the initialization
phase, just as is implemented by mdata-get and related utilities. The
initialization phase includes draining all pending data from the serial
port, writing an empty command and getting an expected error message in
reply. If the initialization phase times out, it is retried every five
seconds. Each timeout results in a warning message: "Timeout while
initializing metadata client. Is the host metadata service running?" By
default, warning messages are logged to the console, thus the reason for a
hung boot is readily apparent.

LP: #1667735

025ddc0... by Mike Gerdts

DataSourceSmartOS: change default fs on ephemeral disk from ext3 to ext4.

ext3 is not able to support file system sizes that are needed in Joyent's
cloud. For the default block size of 4k, the maximum filesystem size
for ext3 is 2^32 * 4096 = 16 TiB.

This changes the default file system type from ext3 to ext4.

LP: #1763511

acca826... by Scott Moser

pycodestyle: Fix invalid escape sequences in string literals.

Python has deprecated these invalid string literals now
  https://bugs.python.org/issue27364
and pycodestyle is identifying them with a W605 warning.
  https://github.com/PyCQA/pycodestyle/pull/676

So basically, any use of \ not followed by one of [\'"abfnrtv]
or \ooo (octal) \xhh (hex) or a newline is invalid. This is most
comomnly seen for us in regex. To solve, you either:
 a.) use a raw string r'...'
 b.) correctly escape the \ that was not intended to be interpreted.

6a979bb... by Ryan Harper

Implement bash completion script for cloud-init command line

In bash shells with bash_completion enabled, now the cloud-init
sub commands and parameters/flags will be shown.

49b562c... by Chad Smith

tools: Fix make-tarball cli tool usage for development

This tool is used to assist during the creation of ubuntu packages for
release testing. Address the following on the command-line:
 * --help option now print usage
 * Add --orig-tarball which creates named output file
   cloud-init_<release-version>.orig.tar.gz
 * drop unused --verbose option

4b86ab9... by Scott Moser

renderer: support unicode in render_from_file.

If a file passed to render_from_file had non-ascii text then
jinja in python2 would decode as ascii, which would cause
UnicodeDecodeError. This issue can be re-created in python2
with just:
 'can\xe2\x80\x99t'.decode()

The solution here is to explicitly pass in unicode supporting
type (py3 str, py2 unicode). Those are six.text_type.
Then jinja does not try to decode.

The reason we hit this is that load_file calls decode_binary.
decode_binary believes it has no work to do if it got a six.string_types.
  isinstance('can\xe2\x80\x99t', six.string_types) == True
So it returns the original string which will blow up for jinja.

Our fix here then is to load the file in binary mode and explicitly
decode it to utf-8. Then in python2 we'll have a unicode type
and in python3 we'll have a string type.