summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-04-12DigitalOcean: assign IPv4ll address to lowest indexed interface.Ben Howard
Previously the IPv4LL address for metadata discovery was assigned to the first interfaces from an alphabetic sort. On DigitalOcean, the metadata is only accessible from the first interface. This fixes a problem where the IPv4LL address is bound to the wrong interface with snapshots. This is part of general improvements to the DigitalOcean Datasource in bug 1676908.
2017-04-12DigitalOcean: configure all NICs presented in meta-data.Ben Howard
Instead of only configuring 'public' and 'private' interfaces, we want to configure any that has been defined in the meta-data. For legacy reasons, the 'public' and 'private' interfaces are maintained as 'eth0' and 'eth1' respectively. This is part of bug 1676908 for general DigitalOcean datasource fixups.
2017-04-12Remove (and/or fix) URL shortener referencesJon Grimm
Several references that were using URL shorteners are now broken due to their service going away, making it painful to even figure out what they were supposed to be pointing at. Put back long URLS using '# noqa' to make flake8 happy. LP: #1669727
2017-04-12HACKING.rst: more info on filling out contributors agreement.Scott Moser
When signing the Contributors agreement, the user is prompted to provide a 'Project contact' or 'Canonical Project Manager'. Just update the HACKING.rst document to tell them what to put there.
2017-04-12util: teach write_file about copy_mode optionLars Kellogg-Stedman
On centos/fedora/rhel/derivatives, /etc/ssh/sshd_config has mode 0600, but cloud-init unilaterally sets file modes to 0644 when no explicit mode is passed to util.write_file. On ubuntu/debian, this file has mode 0644. With this patch, write_file learns about the copy_mode option, which will cause it to use the mode of the existing file by default, falling back to the explicit mode parameter if the file does not exist. LP: #1644064 Resolves: rhbz#1295984
2017-04-11DigitalOcean: bind resolvers to loopback interface.Ben Howard
This change makes the DigitalOcean datasource consistent with OpenStack and Joyent by binding the resolver addresses to the loopback interface. This _is_ a work-around to bug 1675571. Part of bug 1676908.
2017-04-11tests: fix AltCloud tests to not rely on blkidScott Moser
This just mocks out the AltCloud tests to not invoke blkid. Our tests should not rely on system command returning any specific value. Also, shorten long lines with change in the import name of DataSourceAltCloud. LP: #1636531
2017-04-03OpenStack: add 'dvs' to the list of physical link types.Scott Moser
Links presented in network_data.json to the guest running on ESXi are of type 'dvs'. LP: #1674946
2017-03-31Fix bug that resulted in an attempt to rename bonds or vlans.Scott Moser
When cloud-init ran in the init stage (after networking had come up). A bug could occur where cloud-init would attempt and fail to rename network devices that had "inherited" mac addresses. The intent of apply_network_config_names was always to rename only the devices that were "physical" per the network config. (This would include veth devices in a container). The bug was in creating the dictionary of interfaces by mac address. If there were multiple interfaces with the same mac address then renames could fail. This situation was guaranteed to occur with bonds or vlans or other devices that inherit their mac. The solution is to change get_interfaces_by_mac to skip interfaces that have an inherited mac. Also drop the 'devs' argument to get_interfaces_by_mac. It was non-obvious what the result should be if a device in the input list was filtered out. ie should the following have an entry for bond0 or not. get_interfaces_by_mac(devs=['bond0']) LP: #1669860
2017-03-31tests: update OpenNebula and Digital Ocean to not rely on host interfaces.Scott Moser
Mock the use use of get_interfaces_by_mac in Digital Ocean and OpenNebula. Its best to mock this for the tests as the results aren't expecting it to fail. Note, as it stands, OpenNebula relies on devices named 'eth0'. The metadata (context) does not provide mac addresses.
2017-03-30net: in netplan renderer delete known image-builtin content.Scott Moser
When rendering network configuration to netplan, remove known "builtin" configurations. The specific example here is Ubuntu Core that has netplan configuration in etc/netplan/00-snapd-config.yaml. We also delete the derived files since netplan will have created these derived files in its generator that runs well before cloud-init. LP: #1675576
2017-03-30doc: correct grammar in capabilities.rstDavid Tagatac
2017-03-30ds-identify: fix detecting of maas datasource.Scott Moser
The reading of MAAS datasource configuration was simply broken. it was looking in /etc/cloud/*maas*.cfg rather than /etc/cloud/cloud.cfg.d/*maas*.cfg. along side here there is also: * doc improvement on check_config * remove the path restrictions when searching for values in both maas and ovf_vmware_guest_customization. that was done to improve performance as check_config's parsing is slow. * change to maas to search all config files rather than restricting to a subset as it tried before. that was done for * better variable names. - rename path_cloud_confd to path_etc_cloud - PATH_ETC_CLOUD: /etc/cloud - PATH_ETC_CI_CFG: /etc/cloud/cloud.cfg - PATH_ETC_CI_CFG_D: /etc/cloud/cloud.cfg.d LP: #1677710
2017-03-30netplan: remove debugging prints, add debug loggingRyan Harper
Remove debugging print statements. Change a few to use logging.debug() where useful.
2017-03-29ds-identify: do not write None twice to datasource_list.Scott Moser
If the only the None datasource was listed in datasource_list, then ds-identify would write a cloud.cfg witih: datasource_list: [None, None] The fix is to just append None if the list only has None.
2017-03-29support resizing partition and rootfs on system booted without initramfs.Steve Langasek
When booted without an initramfs, the root device will be /dev/root, not a named device. There is partial support for this when resizing filesystems, but not for growing partitions, without which it doesn't do much good. Move the /dev/root resolution code to util.py and use it from cc_growpart.py. Also, booting without an initramfs only works with a root= argument that's either a kernel device name (which is unstable) or a partition UUID. Handle the case of root=PARTUUID=value, not just LABEL and UUID. LP: #1677376
2017-03-29apt_configure: run only when needed.Scott Moser
Do not bother configuring apt if no 'apt' config is provided and either: a.) running on snappy b.) there is no 'apt' command (possibly a different distro) If apt config is provided in either of the above situations, then config will continue. LP: #1675185
2017-03-28OpenStack: identify OpenStack by product 'OpenStack Compute'.Scott Moser
OpenStack clouds installed with RedHat RDO have the nova product configured in /etc/nova/release to be 'OpenStack Compute' rather than upstream nova default of 'OpenStack Nova'. This was first reported on Finnish provider Nebula (http://nebula.fi). LP: #1675349
2017-03-27GCE: Search GCE in ds-identify, consider serial number in check.Scott Moser
While documentation indicates that the smbios product name should contain 'Google Compute Engine', experimentation and bug reports indicate that is not always the case. The change here is to change the check for GCE to also consider a serial number that starts with 'GoogleCompute-'. Also, ds-identify was not currently searching for GCE if no config of datasource_list was found. Most images have a datasource_list defined. So update the list to include GCE. LP: #1674861
2017-03-24Add support for setting hashed passwordsTore S. Lonoy
This change will add support for hashed passwords in cc_set_passwords. It checks if a password is a hash with by checking that it matches in fairly safe way, and also that the password does not have a ":" in it. chpasswd needs to know if the password is hashed or not, so two lists is created so chpasswd is feed with the correct one. LP: #1570325
2017-03-24Fix filesystem creation when using "partition: auto"Jonathan Ballet
Accordingly to the documentation: The ``partition`` option may also be set to ``auto``, in which this module will search for the existance of a filesystem matching the ``label``, ``type`` and ``device`` of the ``fs_setup`` entry and will skip creating the filesystem if one is found. However, using this "auto" flag always recreates the partition no matter if it has been done before or not. This commit fixes a bug in which the "partition" attribute was always set to None although in some cases it should not. LP: #1634678
2017-03-24ConfigDrive: support reading config drive data from /config-drive.Scott Moser
This is thie cloud-init part of a fix to allow nova-lxd to provide config drive data. The other part will be done in nova-lxd. The agreement here is that nova-lxd will copy the contents of the config drive to /config-drive in the container. LP: #1673411
2017-03-24ds-identify: fix detection of Bigstep datasource.Scott Moser
The path for checking presence of Bigstep datasource was simply wrong. Set the correct path. LP: #1674766
2017-03-24test: add running of pylintJoshua Powers
Now tox will run pylint. The .pylintrc file sets pylint to only produce errors, and will ignore certain classes that are known problematic (six).
2017-03-22ds-identify: fix bug where filename expansion was left on.Scott Moser
The script is written to have the protection of disabling filename expansion (set -f) and explicitly enabling expansion when needed. However, the check_config function failed to disable it after enabling.
2017-03-22advertise network config v2 support (NETWORK_CONFIG_V2) in features.Scott Moser
ef18b8ac4c added support for handing network config v2 (aka netplan format). This just adds that feature to the list of supported features.
2017-03-21Bigstep: fix bug when executing in python3.root
Python 2's json.loads would accept bytes, so this bug was only exposed in python3.
2017-03-21Fix unit test when running in a system deployed with cloud-init.Scott Moser
test_netconfig.py:test_apply_network_config_eni_ub would attempt to remove any .link files that cloud-init had written. This was just a failure to mock out all of its interaction with the host.
2017-03-21Bounce network interface for Azure when using the built-in path.Brent Baude
When deploying on Azure and using only cloud-init, you must "bounce" the network interface to trigger a DDNS update. This allows dhclient to register the hostname with Azure so that DNS works correctly on their private networks (i.e. between vm and vm). The agent path was already doing the bounce so this creates parity between the built-in path and the agent. LP: #1674685
2017-03-20cloudinit.net: add network config v2 parsing and renderingRyan Harper
Network configuration version 2 format is implemented in a package called netplan (nplan)[1] which allows consolidated network config for multiple network controllers. - Add a new netplan renderer - Update default policy, placing eni and sysconfig first This requires explicit policy to enable netplan over eni on systems which have both (Yakkety, Zesty, UC16) - Allow any network state (parsed from any format cloud-init supports) to render to v2 if system supports netplan. - Move eni's _subnet_is_ipv6 to common code for use by other renderers - Make sysconfig renderer always emit /etc/syconfig/network configuration - Update cloud-init.service systemd unit to also wait on systemd-networkd-wait-online.service 1. https://lists.ubuntu.com/archives/ubuntu-devel/2016-July/039464.html
2017-03-20net: Fix incorrect call to isfileJoshua Powers
Previous commit introduced a regression by calling os.path.is_file, a non-existent function. This changes that call to use os.path.isfile. LP: #1674317
2017-03-17net: add renderers for automatically selecting the renderer.Scott Moser
Previously, the distro had hard coded which network renderer it would use. This adds support for just picking the right renderer based on what is available. Now, that can be set via a priority in system_info, but should generally work. That config looks like: system_info: network: renderers: ["eni", "sysconfig"] When no renderers are found, a specific RendererNotFoundError is raised. stages.py is modified to catch that and log it at error level. This path should not really be exercised, but could occur if for example an Ubuntu system did not have ifupdown, or a rhel system did not have sysconfig. In such a system previously we would have quietly rendered ENI configuration but that would have been ignored. This is one step better in that we at least log the error.
2017-03-17doc: fix config drive doc with regard to unpartitioned disks.Scott Moser
The ConfigDrive datasource has read un-partitioned disks for quite a while, but the documentation lagged behind. LP: #1673818
2017-03-17test: Adding integratiron test for password as listJoshua Powers
This adds an integration test for setting passwords when given as a list rather than a string. This also updates the docs and tests so that Random is now RANDOM as is correct.
2017-03-17render_network_state: switch arguments around, do not require targetScott Moser
render_network_state should default to rendering on /. The changes here just make it so render_network_state does not require a target, but defaults to None, and uses target_path to handle that.
2017-03-17support 'loopback' as a device type.Scott Moser
As reported in bug 1671927, sysconfig had an issue with rendering a loopback device. The problem was that some as yet unknown issue was causing the openstack config drive to parse the provided ENI file rather than reading the network_data.json. Parsing an ENI file would add a a 'lo' device of type 'physical', and sysconfig was failing to render that. The change here is: a.) add a 'loopback' type rather than 'physical' for network config. {'name': 'lo', 'type': 'loopback', 'subnets': ['type': 'loopback']} b.) support skipping that type in the eni and sysconfig renderers. c.) make network_state just piggy back on 'physical' renderer for loopback (this was what was happening before). Tests are added for eni and sysconfig renderer.
2017-03-17Integration Testing: improve testcase subclassingWesley Wiedenmeier
Use inspect.getmro(mod) rather than mod.__bases__ to test if a potential testcase class inherits from CloudTestCase. This allows testcases to be based on CloudTestCase indirectly, adding greater flexibility to the structure of test classes.
2017-03-13gitignore: adding doc/rtd_htmlJoshua Powers
When running tox -e doc it produces the complete read the docs output and places it in doc/rtd_html. This is not ignored by git and shows up as uncommited changes.
2017-03-13doc: add instructions for running integration tests via tox.Joshua Powers
Add instructions on how to run the cii tests to the docs.
2017-03-13test: avoid differences in 'date' output due to daylight savings.Scott Moser
When testing for timezone we were testing that 'date' output would contain 'HDT' for the current time. But after a 'spring forward', the current time started to have 'HST'. Instead of asking 'date' for the timezone that applies now, ask it for a static date.
2017-03-13Fix chef config module in omnibus install.Jeremy Melvin
Omnibus installation of chef was broken under python3. LP: #1583837
2017-03-10Add feature flags to cloudinit.version.Wesley Wiedenmeier
This exposes a mechanism for users of cloud-init to determine if a version has a specific feature, and adds documentation to that affect. We list an existing feature NETWORK_CONFIG_V1 as an example. Also add a 'features' subcommand for listing these to stdout.
2017-03-10tox: add a citest environmentScott Moser
Because the tests/cloud_tests require specific version of pylxd adding a tox environment makes that much easier. Additionally it makes calling it at least a bit simpler. Example: tox -e citest -- run -v -n zesty --deb=cloud-init_all.deb
2017-03-10Further fix regression to support 'password' for default user.Scott Moser
The adjusted change did not support #cloud-config password: passw0rd This correctly fixes that regression.
2017-03-10fix regression when no chpasswd/list was provided.Scott Moser
This regression was caused by my rework of Sergio's branch. The change now still works when there is no chpasswd/list provided.
2017-03-09Support chpasswd/list being a list in addition to a string.Sergio Lystopad
cc_set_passwords previously supported 'list' as a multiline string: chpasswd: list: | user:pass1 user015:R This patch adds support for user/pairs as a list: chpasswd: list: - user:pass1 - user015:R LP: #1665694
2017-03-07doc: Fix configuration example for cc_set_passwords module.Sergio Lystopad
The documentation indicated chpasswd/list should be a list when the code only accepts a string. LP: #1665773
2017-03-07net: support both ipv4 and ipv6 gateways in sysconfig.Lars Kellogg-Stedman
Previously, cloud-init would throw an exception if an interface had both ipv4 and ipv6 addresses and a default gateway for each address family. This change allows cloud-init to correctly configure interfaces in this situation. LP: #1669504
2017-03-07net: do not raise exception for > 3 nameserversLars Kellogg-Stedman
log a warning rather than raising ValueError if we see more than three nameserver addresses. LP: #1670052
2017-03-06ds-identify: report cleanups for config and exit value.Scott Moser
Change policy so that 'report' can be overridden. In xenial we had set the builtin default to be 'report', expecting that Ubuntu core would install config that changed it to 'search'. However, if report was already set, there was no way to unset it. The change here is to make 'report' basically 'search-dryrun', so that one or the other can be set. The other change here is that report would actually exit disabled if it did not find a datasource and notfound=disabled. That was unexpected and would turn cloud-init off, which is not what we wanted. Additionally, consistently use 'enabled' or 'disabled' versus 'enable' and 'disable'. LP: #1669949