summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-02-25Enable encrypted_data_bag_secret support for ChefEric Williams
Encrypted data bags require a secrets file to be present to decrypt, and the location of the file must be configured the Chef client configuration file, client.rb. This update enables cloud-init's chef module to update that setting in client.rb. LP: #1817082
2019-02-22azure: Filter list of ssh keys pulled from fabricJason Zions (MSFT)
The Azure data source is expected to expose a list of ssh keys for the user-to-be-provisioned in the crawled metadata. When configured to use the __builtin__ agent this list is built by the WALinuxAgentShim. The shim retrieves the full set of certificates and public keys exposed to the VM from the wireserver, extracts any ssh keys it can, and returns that list. This fix reduces that list of ssh keys to just the ones whose fingerprints appear in the "administrative user" section of the ovf-env.xml file. The Azure control plane exposes other ssh keys to the VM for other reasons, but those should not be added to the authorized_keys file for the provisioned user.
2019-02-22doc: update merging doc with fixes and some additional details/examplesRyan Harper
Update config merging documentation with cloud-config syntax fix. Add an example showing how to merge two files with runcmd.
2019-02-22tests: integration test failure summary to use traceback if empty errorChad Smith
When integration tests verification fails, the object returned contains has 'error' and 'traceback' keys. Each key can contain empty strings. If the simplified 'error' message is empty, fallback and use the more verbose full 'traceback' text in the failure summary.
2019-02-18This is to fix https://bugs.launchpad.net/cloud-init/+bug/1812676Vitaly Kuznetsov
2019-02-14EC2: Rewrite network config on AWS Classic instances every bootGuilherme G. Piccoli
AWS EC2 instances' network come in 2 basic flavors: Classic and VPC (Virtual Private Cloud). The former has an interesting behavior of having its MAC address changed whenever the instance is stopped/restarted. This behavior is not observed in VPC instances. In Ubuntu 18.04 (Bionic) the network "management" changed from ENI-style (etc/network/interfaces) to netplan, and when using netplan we observe the following block present in /etc/netplan/50-cloud-init.yaml: match: macaddress: aa:bb:cc:dd:ee:ff Jani Ollikainen noticed in Launchpad bug #1802073 that the EC2 Classic instances were booting without network access in Bionic after stop/restart procedure, due to their MAC address change behavior. It was narrowed down to the netplan MAC match block, that kept the old MAC address after stopping and restarting an instance, since the network configuration writing happens by default only once in EC2 instances, in the first boot. This patch changes the network configuration write to every boot in EC2 Classic instances, by checking against the "vpc-id" metadata information provided only in the VPC instances - if we don't have this metadata value, cloud-init will rewrite the network configuration file in every boot. This was tested in an EC2 Classic instance and proved to fix the issue; unit tests were also added for the new method is_classic_instance(). LP: #1802073 Reported-by: Jani Ollikainen <jani.ollikainen@ik.fi> Suggested-by: Ryan Harper <ryan.harper@canonical.com> Co-developed-by: Chad Smith <chad.smith@canonical.com> Signed-off-by: Guilherme G. Piccoli <gpiccoli@canonical.com>
2019-02-08netinfo: Adjust ifconfig output parsing for FreeBSD ipv6 entriesRyan Harper
FreeBSD ifconfig output for ipv6 addrs doesn't find scopeid values when present in the output and the pformat rendering assumes that an ipv6 address will have a 'scope6' entry in the netdev info dictionary. This patch finds the scopeid value, which is not always inside <>, and in some cases v6 addrs don't have a scopeid value in the output, so when rendering the table, allow scope6 value to be replaced with the empty value. LP: #1779672
2019-02-07netplan: Don't render yaml aliases when dumping netplanRyan Harper
Cloud-init rendered netplan with duplicate aliases if a network config included "global" nameserver/search values. Netplan uses can read yaml files which do use aliaes but cloud-init did not render a single yaml dictionary, instead it combined yaml sections into a single document which sometimes resulted in duplicate aliases being present. This branch introduces a yaml SafeDumper class which can set the 'ignore_aliases' attribute. This is not enabled by default but callers to util.yaml_dumps can pass a boolean to toggle this. The netplan render uses noalias=True and the resulting yaml output does not contain any aliases. LP: #1815051
2019-02-07add PyCharm IDE .idea/ path to .gitignoreDominic Schlegel
2019-02-06correct grammar issue in instance metadata documentationDominic Schlegel
LP: #1802188
2019-01-31clean: cloud-init clean should not trace when run from within cloud_dirChad Smith
Avoid traceback when cloud-init clean is run from within /var/lib/cloud/ deleted dirs. LP: #1795508
2019-01-30Resolve flake8 comparison and pycodestyle over-ident issuesParide Legovini
Fixes: - flake8: use ==/!= to compare str, bytes, and int literals - pycodestyle: E117 over-indented
2019-01-28opennebula: also exclude epochseconds from changed environment varsChad Smith
In addition to EPOCHREALTIME there is also an EPOCHSECONDS environment variable that OpenNebula needs to exclude as it is expected to change. This commit supplements the other exclusion in commit d1a2fe7307e9cf2251d1f9a666c12d71d3f522d6. Without this fix, unittests will intermittently fail if parse_shell_config is run across a timing boundary where the EPOCHSECONDS changes mid-test. LP: #1813641
2019-01-28systemd: Render generator from template to account for system differences.Robert Schweikert
The systemd generator used had a hard coded path for the location target file to create. This path does not apply to all distributions. Make the generator and template to have the path set during build time.
2019-01-28sysconfig: On SUSE, use STARTMODE instead of ONBOOTRobert Schweikert
ONBOOT is not recognized on openSUSE and SUSE Linux Enterprise, add the STARTMODE setting LP: #1799540
2019-01-28flake8: use ==/!= to compare str, bytes, and int literalsParide Legovini
2019-01-26opennebula: exclude EPOCHREALTIME as known bash env variable with a deltaChad Smith
This branch is needed to allow cloud-init to sbuild on Ubuntu Disco. OpenNebula:parse_shell_config tries to do a comparison of bash environment values, excluding expected environment variables which are known to change. Bash on Ubuntu Disco surfaces a new EPOCHREALTIME environment variable which wasn't in previous bash environments, this var needs to be ignored by parse_shell_config too. LP: #1813383
2019-01-25tox: fix disco httpretty dependencies for py37Chad Smith
LP: #1813361
2019-01-25run-container: uncomment baseurl in yum.repos.d/*.repo when using a proxyParide Legovini
When using a proxy it is often useful to know in advance which mirrors are to be contacted, so a whitelist can be set up. This is not easy when using the yum.conf(5) mirrorlist option, as the retrieved list of mirrors may change. The repository definition may also specify a canonical mirror with the 'baseurl' option; this option is often commented out by default to favor the usage of worldwide mirrors. This patch uncomments 'baseurl' when an http_proxy is being used, so the canonical mirror is used *in addition to* the mirrors retrieved from the mirrorlist.
2019-01-25lxd: install zfs-linux instead of zfs meta packageJohnson Shi
When using the LXD module cloud-init will attempt to install ZFS if it does not exist on the target system. However instead of installing the `zfsutils-linux` package it attempts to install `zfs` resulting in an error. Ubuntu Xenial (16.04) has zfs meta package, but Bionic (18.04) does not. Use the specific base package instead of zfs meta. Co-authored-by: Michael Skalka <michael.skalka@canonical.com> LP: #1799779
2019-01-23net/sysconfig: do not write a resolv.conf file with only the header.Robert Schweikert
Writing the file with no dns information may prevent distro tools from writing a resolv.conf file with dns information obtained from a dhcp server.
2019-01-18net: Make sysconfig renderer compatible with Network Manager.Eduardo Otubo
The 'sysconfig' renderer is activated if, and only if, there's ifup and ifdown commands present in its search dictonary or the network-scripts configuration files are found. This patch adds a check for Network- Manager configuration file as well. This solution is based on the use of the plugin 'ifcfg-rh' present in Network-Manager and is designed to support Fedora 29 or other distributions that also replaced network-scripts by Network-Manager.
2019-01-15cc_set_passwords: Fix regex when parsing hashed passwordsMarlin Cremers
Correct invalid regex to match hashes starting with the following: - $1, $2a, $2y, $5 or $6 LP: #1811446
2019-01-15net: Wait for dhclient to daemonize before reading lease fileJason Zions
cloud-init uses dhclient to fetch the DHCP lease so it can extract DHCP options. dhclient creates the leasefile, then writes to it; simply waiting for the leasefile to appear creates a race between dhclient and cloud-init. Instead, wait for dhclient to be parented by init. At that point, we know it has written to the leasefile, so it's safe to copy the file and kill the process. cloud-init creates a temporary directory in which to execute dhclient, and deletes that directory after it has killed the process. If cloud-init abandons waiting for dhclient to daemonize, it will still attempt to delete the temporary directory, but will not report an exception should that attempt fail. LP: #1794399
2019-01-15[Azure] Increase retries when talking to Wireserver during metadata walkJason Zions
Testing startup of large numbers of VMs (of varying distros) in Azure shows that 3 retries results in a small percentage of failed VMs. Increasing that by a few dramatically decreases the occurrence of provisioning timeout errors. The initial choice of "3 retries" was uninformed by heavy testing. Also, the alternate provisioning mechanism for Azure (waagent) retries the Wireserver crawl without limit. 10 retries seems a more reasonable choice.
2019-01-08Add documentation on adding a datasource.Scott Moser
This adds documentation intended for a developer on how to add a new datasource to cloud-init.
2019-01-08doc: clean up some datasource documentation.Scott Moser
The change to datasources.rst here is obvious typo fix. The change to azure is to reduce the two 'Customization' sections to a single and clean up some other duplicate text.
2018-12-20ds-identify: fix wrong variable name in ovf_vmware_transport_guestinfo.Scott Moser
ovf_vmware_transport_guestinfo is not currently tested. It used '$1' instead of '$out' when checking for xml content in the output of vmware-rpctool.
2018-12-20Scaleway: Support ssh keys provided inside an instance tag.PORTE Loïc
The change here will utilize ssh keys found inside an instance's tag. The tag value must start with 'AUTHORIZED_KEY'.
2018-12-20OVF: simplify expected return values of transport functions.Scott Moser
Transport functions (transport_iso9660 and transport_vmware_guestinfo) would return a tuple of 3 values, but only the first was ever used outside of test. The other values (device and filename) were just ignored. This just simplifies the transport functions to now return content (in string format) or None indicating that the transport was not found.
2018-12-20Vmware: Add support for the com.vmware.guestInfo OVF transport.Scott Moser
This adds support for reading OVF information over the 'com.vmware.guestInfo' tranport. The current implementation requires vmware-rpctool be installed in the system. LP: #1807466
2018-12-18HACKING.rst: change contact info to Josh PowersScott Moser
In the Hacking doc, change the contact information for the contributors agreement to reference Josh Powers rather than Scott Moser.
2018-12-14Update to pylint 2.2.2.Scott Moser
The tip-pylint tox target correctly reported the invalid use of string formatting. The change here is to: a.) Fix the error that was caught. b.) move to pylint 2.2.2 for the default 'pylint' target.
2018-12-13Release 18.5Ryan Harper
Bump the version in cloudinit/version.py to be 18.5 and update ChangeLog. LP: #1808380
2018-12-11tests: add Disco releaseJoshua Powers
2018-12-11net: render 'metric' values in per-subnet routesRyan Harper
It is possible to have a metric value in a per-subnet route. This is currently missing in all renderers. Update each renderer to emit the correct metric value from the config. LP: #1805871
2018-12-06write_files: add support for appending to files.James Baxter
Add 'append: true' to write_files entries to append 'content' to file specified by 'path' key. This modifies the file open mode to append.
2018-12-04config: On ubuntu select cloud archive mirrors for armel, armhf, arm64.Scott Moser
Infrastructure is now set up for Ubuntu to handle Amazon instances hitting a ports archive at: - http://%(ec2_region)s.ec2.ports.ubuntu.com/ubuntu-ports/ And additionally, generic mirrors at *.clouds.ports.ubuntu.com/ubuntu-ports The change here will utilize those mirrors for the arm64, armel and armhf arches. We've decided to limit the auto-selection of those mirrors to arm, where we know a use case. That way new instances of ppc64el or other arches will not select them. Such a behavior change could be problematic for a user in a firewalled environment. LP: #1805854
2018-12-03dhclient-hook: cleanups, tests and fix a bug on 'down' event.Scott Moser
I noticed a bug in dhclient_hook on the 'down' event, using 'is' operator rather than '==' (if self.net_action is 'down'). This refactors/simplifies the code a bit for easier testing and adds tests. The reason for the rename of 'action' to 'event' is to just be internally consistent. The word and Namespace 'action' is used by cloud-init main, so it was not really usable here. Also adds a main which can easily be debugged with: CI_DHCP_HOOK_DATA_D=./my.d python -m cloudinit.dhclient_hook up eth0
2018-12-03NoCloud: Allow top level 'network' key in network-config.Scott Moser
NoCloud's 'network-config' file was originally expected to contain network configuration without the top level 'network' key. This was because the file was named 'network-config' so specifying 'network' seemed redundant. However, JuJu is currently providing a top level 'network' config when it tries to disable networking ({"network": {"config": "disabled"}). Other users have also been surprised/confused by the fact that a network config in /etc/cloud/cloud.cfg.d/network.cfg differed from what was expected in 'network-config'. LP: #1798117
2018-12-03ovf: Fix ovf network config generation gateway/routesRyan Harper
Move routes under the nic's subnet rather than use top-level ("global") route config ensuring all net renderers will provide the configured route. Also updated cloudinit/cmd/devel/net_convert.py:  - Add input type 'vmware-imc' for OVF customization config files  - Fix bug when output-type was netplan which invoked netplan   generate/apply and attempted to write to   /etc/netplan/50-cloud-init.yaml instead of joining with the   output directory. LP: #1806103
2018-11-29azure: detect vnet migration via netlink media change eventTamilmani Manoharan
Replace Azure pre-provision polling on IMDS with a blocking call which watches for netlink link state change messages. The media change event happens when a pre-provisioned VM has been activated and is connected to the users virtual network and cloud-init can then resume operation to complete image instantiation.
2018-11-29Azure: fix copy/paste error in error handling when reading azure ovf.Adam DePue
Check the appropriate variables based on code review. Correcting what seems to be a copy/paste mistake for the error handling from a few lines above.
2018-11-28tests: fix incorrect order of mocks in test_handle_zfs_root.Scott Moser
The order of parameters to test_handle_zfs_root did not match the order of the mocks applied. Thanks to Jason Zions for pointing this out.
2018-11-28doc: Change dns_nameserver property to dns_nameservers.Tomer Cohen
According to the examples in the page, v1 network config DNS should be defined using the dns_nameservers. The singular dns_nameserver is undefined.
2018-11-27OVF: identify label iso9660 filesystems with label 'OVF ENV'.Scott Moser
When deploying an OVA, at least some versions of vmware attach a cdrom with an ISO9660 filesystem label of 'OVF ENV'. This was seen on Vmware vCenter Server, 6.0.0, 2776510. In order to accomplish this we had to change the content of the DI_ISO9660_DEVS variable to be comma delimited rather than space delimited.
2018-11-27logs: collect-logs ignore instance-data-sensitive.json on non-root userChad Smith
Since /run/cloud-init/instance-data-sensitive.json is root read-only, ignore this file if non-root user runs collect-logs. If --include-userdata is provided on the command line, exit in error if non-root user attempts this operation. Lastly, update the __main__ to exit based on return value of main. LP: #1805201
2018-11-26net: Ephemeral*Network: add connectivity check via URLChad Smith
We add a new Optional parameter: connectivity_url This is used in __enter__ to verify if a connection already exists. If it does exist, no operations are performed.
2018-11-15azure: _poll_imds only retry on 404. Fail on TimeoutChad Smith
Upon URL timeout, _poll_imds is expected to re-dhcp to get updated IP configuration. We don't want to indefinitely retry because the instance likely has invalid IP configuration. LP: #1803598
2018-11-14resizefs: Prefix discovered devpath with '/dev/' when path does not existIgor Galić
In some environments, like FreeBSD, gpart can return the device basename instead of the full path. If this discovered devpath does not exist and is missing the '/dev/' prefix, add that prefix in an attempt to find the device.