summaryrefslogtreecommitdiff
path: root/cloudinit
AgeCommit message (Collapse)Author
2019-07-18Fix bug rendering MTU on bond or vlan when input was netplan.Scott Moser
If input to network_state.parse_net_config_data was netplan (v2 yaml) then the network state would lose the mtu information on bond or vlan. LP: #1836949
2019-07-17net: update net sequence, include wait on netdevs, opensuse netrules pathRyan Harper
On systems with many interfaces, processing udev events may take a while. Cloud-init expects devices included in a provided network-configuration to be present when attempting to configure them. This patch adds a step in net configuration where it will check for devices provided in the configuration and if not found, issue udevadm settle commands to wait for them to appear. Additionally, the default path for udev persistent network rules 70-persistent-net.rules may also be written to systems which include the 75-net-generator.rules. During boot, cloud-init and the generator may race and interleave values causing issues. OpenSUSE will now use a newer file, 85-persistent-net-cloud-init.rules which will take precedence over values created by 75-net-generator and avoid collisions on the same file. LP: #1817368
2019-07-17Release 19.2Ryan Harper
Bump the version in cloudinit/version.py to be 19.2 and update ChangeLog. LP: #1836921
2019-07-16net: add rfc3442 (classless static routes) to EphemeralDHCPRyan Harper
The EphemeralDHCP context manager did not parse or handle rfc3442 classless static routes which prevented reading datasource metadata in some clouds. This branch adds support for extracting the field from the leases output, parsing the format and then adding the required iproute2 ip commands to apply (and teardown) the static routes. LP: #1821102
2019-07-16Support netplan renderer in Arch LinuxConrad Hoffmann
Support is for now implemented in such a way that it will fall back to the old `_write_network()` if netplan is not available on the image.
2019-07-16VMWare: Trigger the post customization script via cc_scripts module.Xiaofeng Wang
cloud-init does not trigger reboots of a VM therefore adding custom scripts to rc.local does not execute the post scripts. This patch moves post-scripts into per-instance scripts dir and has cc_scripts module run the post-scripts. Also in this branch: - Remove the sh interpreter and execute the customization script directly. - Update the unit test. LP: #1833192
2019-07-15Cloud-init analyze module: Added ability to analyze boot events.Sam Gilson
This branch introduces a new command line feature for cloud-init. Currently, the cloud-init module has the capability to analyze events in cloud-init.log in three ways: 'show', 'blame', 'dump'. These changes add a fourth capability, called 'boot'. Running the command 'cloud-init analyze boot' will provide the user three timestamps. 1) Timestamp for when the kernel starts initializing. 2) Timestamp for when the kernel finishes its initialization. 3) Timestamp for when systemd activates cloud-init. This feature enables cloud-init users to analyze different boot phases. This would aid in debugging performance issues related to cloud-init startup or tracking regression.
2019-07-15Update debian eni network configuration location, retain Ubuntu settingJanos Lenart
On Debian, ifupdown uses `source-directory /etc/network/interfaces.d` (for new installs) to include files. https://salsa.debian.org/debian/ifupdown/blob/master/debian/postinst#L23 The current filename, 50-cloud-init.cfg, does not match against the RE that is used to scan the directory for configurations (ASCII upper- and lower-case letters, ASCII digits, ASCII underscores, and ASCII minus-hyphens): https://salsa.debian.org/debian/ifupdown/blob/master/interfaces.5.pre#L122 Of course many installations use `source /etc/network/interfaces.d/*`, but not all.
2019-07-15net: skip bond interfaces in get_interfacesStanislav Makar
bonds may inherit mac address from a physical interface LP: #1812857
2019-07-10Fix a couple of issues raised by a coverity scanDaniel Watkins
* cc_lxd: fix copy/paste error in debug logging * DataSourceCloudSigma: remove unreachable code * This unreachable code was introduced in a refactor (in 2015) which removed the need for an exception handler, but retained the logging from the exception handler as an unreachable fall-through.
2019-07-03Add missing dsname for Hetzner Cloud datasourceMarkus Schade
2019-06-25azure: add region and AZ properties from imds compute location metadataChad Smith
This allows cloud-init query region to show valid region data for Azure
2019-06-21sysconfig: support more bonding optionsPenghui Liao
Currently, only a few bonding parameters can be configured on sysconfig systems. This patch aims to support more parameters documented on the docs site.
2019-05-31Fix spelling error making 'an Ubuntu' consistent.Brian Murray
2019-05-29netplan: update netplan key mappings for gratuitous-arpRyan Harper
Previous versions of netplan included a misspelling for the bond parameter around gratuitous-arp. This has been fixed and released and cloud-init needs to accept both values. This branch fixes the key that will be rendered and transforms the previous misspelling when capturing network_state. LP: #1827238
2019-05-28freebsd: ability to grow root file systemGonéri Le Bouder
- UFS file system support - GPT partition table support - add support for newfs's -L parameter (label) - move freebsd specific test from Azure to freebsd
2019-05-24freebsd: NoCloud data source supportGonéri Le Bouder
blkid is a Linux-only command. With this patch, cloud-init uses another approach to find the data source on FreeBSD. LP: #1645824
2019-05-10Azure: Return static fallback address as if failed to find endpointJason Zions (MSFT)
The Azure data source helper attempts to use information in the dhcp lease to find the Wireserver endpoint (IP address). Under some unusual circumstances, those attempts will fail. This change uses a static address, known to be always correct in the Azure public and sovereign clouds, when the helper fails to locate a valid dhcp lease. This address is not guaranteed to be correct in Azure Stack environments; it's still best to use the information from the lease whenever possible.
2019-05-09release 19.1Chad Smith
Bump the version on cloudinit/version.py to be 19.1 and update ChangeLog LP: #1828479
2019-05-08cc_mounts: check if mount -a on no-change fstab pathJason Zions (MSFT)
Under some circumstances, cc_disk_setup may reformat volumes which already appear in /etc/fstab (e.g. Azure ephemeral drive is reformatted from NTFS to ext4 after service-heal). Normally, cc_mounts only calls mount -a if it altered /etc/fstab. With this change cc_mounts will read /proc/mounts and verify if configured mounts are already mounted and if not raise flag to request a mount -a. This handles the case where no changes to fstab occur but a mount -a is required due to change in underlying device which prevented the .mount unit from running until after disk was reformatted. LP: #1825596
2019-05-08replace remaining occurrences of LOG.warnDaniel Watkins
2019-05-08DataSourceAzure: Adjust timeout for polling IMDSAnh Vo
If the IMDS primary server is not available, falling back to the secondary server takes about 1s. The net result is that the expected E2E time is slightly more than 1s. This change increases the timeout to 2s to prevent the infinite loop of timeouts.
2019-04-29Azure: Changes to the Hyper-V KVP ReporterAnh Vo
 + Truncate KVP Pool file to prevent stale entries from being processed by the Hyper-V KVP reporter.  + Drop filtering of KVPs as it is no longer needed.  + Batch appending of existing KVP entries.
2019-04-27git tests: no longer show warning about safe yaml.Scott Moser
Currently on 18.04, running tox -e py27 will spew errors like: .tests/unittests/test_net.py:2649: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. The change here just uses cloud-init's yaml, which does safeloading by default.
2019-04-22net/sysconfig: only indicate available on known sysconfig distrosRyan Harper
Restrict the sysconfig renderer availabily to known distros. Ubuntu/Debian systems may include network-manager but they do not have support for reading sysconfig network output; that is enabled via a Network-Manager plugin: ifcfg-rh which is not available in Ubuntu/Debian. LP: #1819994
2019-04-18mount_cb: do not pass sync and rw options to mountGonéri Le Bouder
On FreeBSD, mount_cd9660 does not accept the sync option that is enabled by default. In addition, the sync is only useful with the `rw` mode. However the `rw` mode was never used. This patch removes the `rw` and `sync` parameter of `mount_cb` to simplify the code base and resolve the FreeBSD issue. LP: #1645824
2019-04-17cc_apt_configure: fix typo in apt documentationDominic Schlegel
2019-04-10Revert "DataSource: move update_events from a class to an instance..."Daniel Watkins
Moving update_events from a class attribute to an instance attribute means that it doesn't exist on DataSource objects that are unpickled, causing tracebacks on cloud-init upgrade. As this change is only required for cloud-init installations which don't utilise ds-identify, we're backing it out to be reintroduced once the upgrade path bug has been addressed. This reverts commit f2fd6eac4407e60d0e98826ab03847dda4cde138.
2019-04-09Change DataSourceNoCloud to ignore file system label's case.Risto Oikarinen
NoCloud data source now accepts both 'cidata' and 'CIDATA' as filesystem labels. This is similar to DataSourceConfigDrive's support for 'config-2' and 'CONFIG-2'.
2019-04-09cmd:main.py: Fix missing 'modules-init' key in modes dictAntonio Romito
Cloud-init's main.py will fail when presented with a new stage name 'modules-init' if upgrading an older cloud-init. Fix this by initializing unknown stage names before accessing. LP: #1815109
2019-04-04ubuntu_advantage: rewrite cloud-config moduleChad Smith
ubuntu-advantage-tools version 19 has a different command line interface. Update cloud-init's config module to accept new ubuntu_advantage configuration settings. * Underscores better than hyphens: deprecate 'ubuntu-advantage'   cloud-config key in favor of 'ubuntu_advantage' * Attach machines with either sso credentials of UA user_token * Services are enabled by name though an 'enable' list * Raise warnings if deprecated ubuntu-advantage config keys are   present, or errors if its config we cannott adapt to Ubuntu Advantage support can now be configured via #cloud-config with the following yaml: ubuntu_advantage:   token: 'thisismyubuntuadvantagetoken'   enable: [esm, fips, livepatch] Co-Authored-By: Daniel Watkins <daniel.watkins@canonical.com>
2019-04-03Azure: Treat _unset network configuration as if it were absentJason Zions (MSFT)
When the Azure datasource persists all of its metadata to the instance directory, it deliberately sets the self.network_config value to be the sources.UNSET value. The goal is to ensure that each time the system boots, fresh network configuration data is fetched from the cloud platform so that any control plane changes will take effect. When a VM is first created, there's no pickled instance to restore, so self._network_config is None, resulting in self.network_config() properly building a new config. Azure suffered from LP: #1801364 which prevented ds from being stored in obj.pkl in the instance directory, so subsequent reboots always regenerated their network configuration. Commit 0dc3a77f41f4544e4cb5a41637af7693410d4cdf introduced a new bug in which self.network_config() assumed the self._network_config value was either None or trustable; when the config was unpickled, that value was _unset, thus breaking the assumption. LP: #1823084
2019-04-03DatasourceAzure: add additional logging for azure datasourceAnh Vo
Create an Azure logging decorator and use additional ReportEventStack context managers to provide additional logging details.
2019-03-26Azure: Ensure platform random_seed is always serializable as JSON.Jason Zions (MSFT)
The Azure platform surfaces random bytes into /sys via Hyper-V. Python 2.7 json.dump() raises an exception if asked to convert a str with non-character content, and python 3.0 json.dump() won't serialize a "bytes" value. As a result, c-i instance data is often not written by Azure, making reboots slower (c-i has to repeat work). The random data is base64-encoded and then decoded into a string (str or unicode depending on the version of Python in use). The base64 string has just as many bits of entropy, so we're not throwing away useful "information", but we can be certain json.dump() will correctly serialize the bits.
2019-03-25net/sysconfig: write out SUSE-compatible IPv6 configRobert Schweikert
For writing IPv6 addresses to ifcfg-* the name "IPV6ADDR" is used. For secondary IPs the value for "IPV6ADDR_SECONDARIES" is set. On SUSE based distributions the names "IPADDR6" and "IPADDR6_$SOMELABEL" need to be used.
2019-03-21net: Fix ipv6 static routes when using eni rendererRaphael Glon
When rendering ipv6 static routes in eni format the post-up/pre down commands were not correct for ipv6. LP: #1818669
2019-03-19Add ubuntu_drivers config moduleDaniel Watkins
The ubuntu_drivers config module enables usage of the 'ubuntu-drivers' command. At this point it only serves as a way of installing NVIDIA drivers for general purpose graphics processing unit (GPGPU) functionality. Also, a small usability improvement to get_cfg_by_path to allow it to take a string for the key path "toplevel/second/mykey" in addition to the original: ("toplevel", "second", "mykey")
2019-03-14DataSource: move update_events from a class to an instance attributeDaniel Watkins
Currently, DataSourceAzure updates self.update_events in __init__. As update_events is a class attribute on DataSource, this updates it for all instances of classes derived from DataSource including those for other clouds. This means that if DataSourceAzure is even instantiated, its behaviour is applied to whichever data source ends up being used for boot. To address this, update_events is moved from a class attribute to an instance attribute (that is therefore populated at instantiation time). This retains the defaults for all DataSource sub-class instances, but avoids them being able to mutate the state in instances of other DataSource sub-classes. update_events is only ever referenced on an instance of DataSource (or a sub-class); no code relies on it being a class attribute. (In fact, it's only used within methods on DataSource or its sub-classes, so it doesn't even _need_ to remain public, though I think it's appropriate for it to be public.) DataSourceScaleway is also updated to move update_events from a class attribute to an instance attribute, as the class attribute would now be masked by the DataSource instance attribute. LP: #1819913
2019-03-12net/sysconfig: Handle default route setup for dhcp configured NICsRobert Schweikert
When the network configuration has a default route configured and another network device that is configured with dhcp, SUSE sysconfig output should not accept the default route provided by the dhcp server. LP: #1812117
2019-03-12DataSourceEc2: update RELEASE_BLOCKER to be more accurateDaniel Watkins
Our previous understanding of the upgrade issue was incomplete; it turns out the only change we need is the one now outlined.
2019-03-06Support locking user with usermod if passwd is not available.Scott Moser
In some cases, the 'passwd' command might not be available, but 'usermod' might be. In debian systems both are provided by the 'passwd' package. In Redhat/Centos passwd comes from 'passwd' package while 'usermod' comes from `shadow-utils` This should just support either one with no real cost other than the check.
2019-03-04clean: correctly determine the path for excluding seed directoryDaniel Watkins
Previously, init.paths.cloud_dir has a trailing slash, which meant that "/var/lib/cloud//seed" was being compared to "/var/lib/cloud/seed" and (of course), never matching. In this commit, switch to using os.path.join to avoid this case (and update the tests to catch it in future). LP: #1818571
2019-03-04helpers/openstack: Treat unknown link types as physicalDaniel Watkins
Some deployments of OpenStack expose link types to the guest which cloud-init doesn't recognise. These will almost always be physical, so we can operate more robustly if we assume that they are (whilst warning the user that we're seeing something unexpected). LP: #1639263
2019-03-04drop Python 2.6 support and our NIH version detectionDaniel Watkins
- Remove the last few places that use `if PY26` - Replace our Python version detection logic with six's (which we were already using in most places)
2019-03-04net: append type:dhcp[46] only if dhcp[46] is True in v2 netconfigKurt Stieger
When providing netplan configuration to cloud-init, the internal network state would enable DHCP if the 'dhcp' key was present in the source config. In netplan, dhcp[46] is a boolean and the value of the boolean should control whether DHCP is enabled rather than the presence of the key. This issue leaded to inconsistant sysconfig/network-scripts on fedora. 'BOOTPROTO' was always 'dhcp', even if the address config was static. After this change a dhcp subnet is added only if the 'dhcp' setting in source cfg dict is True. LP: #1818032
2019-02-27cc_apt_pipelining: stop disabling pipelining by defaultDaniel Watkins
This was introduced due to Ubuntu using S3 mirrors, and S3 having a buggy pipelining implementation. Those Ubuntu mirrors are no longer in production and, furthremore, apt has also grown the ability to handle servers with broken pipelining. As such, we can stop disabling pipelining, which should result in improved apt download speeds. LP: #1794982
2019-02-26tests: fix some slow tests and some leaking stateDaniel Watkins
In test_ds_identify, don't mutate otherwise-static test data. When running tests in a random order, this was causing failures due to breaking preconditions for other tests. In tests/helpers, reset logging level in tearDown. Some of the CLI tests set the level of the root logger in a way that isn't correctly reset. For test_poll_imds_re_dhcp_on_timeout and test_dhcp_discovery_run_in_sandbox_warns_invalid_pid, mock out time.sleep; this saves ~11 seconds (or ~40% of previous test time!).
2019-02-26util: don't determine string_types ourselvesDaniel Watkins
six already provides this for us, and we're already paying the cost to determine it there; no need to do it twice.
2019-02-26cc_rsyslog: Escape possible nested setDaniel Watkins
Under Python 3.7, we are seeing `FutureWarning: Possible nested set at position 23`; escaping this bracket causes that warning to disappear. LP: #1816967
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