summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-10-07Allow disabling of network activation (SC-307) (#1048)James Falcon
In #919 (81299de), we refactored some of the code used to bring up networks across distros. Previously, the call to bring up network interfaces during 'init' stage unintentionally resulted in a no-op such that network interfaces were NEVER brought up by cloud-init, even if new network interfaces were found after crawling the metadata. The code was altered to bring up these discovered network interfaces. On ubuntu, this results in a 'netplan apply' call during 'init' stage for any ubuntu-based distro on a datasource that has a NETWORK dependency. On GCE, this additional 'netplan apply' conflicts with the google-guest-agent service, resulting in an instance that can no be connected to. This commit adds a 'disable_network_activation' option that can be enabled in /etc/cloud.cfg to disable the activation of network interfaces in 'init' stage. LP: #1938299
2021-10-07renderer: convert relative imports to absolute (#1052)Paride Legovini
Fixes the following pylint error: cloudinit/net/renderer.py:12: [E0611(no-name-in-module), ] No name 'generate_udev_rule' in module 'udev' Likely a false positive, but we don't really need to keep the imports relative, so let's convert them to absolute as a workaround.
2021-10-07Support ETHx_IP6_GATEWAY, SET_HOSTNAME on OpenNebula (#1045)Vlastimil Holer
OpenNebula 6.1.80 (current dev. version) is introducing new IPv6 gateway contextualization variable ETHx_IP6_GATEWAY, which mimics existing variable ETHx_GATEWAY6. The ETHx_GATEWAY6 used until now will be depracated in future relase (ET spring 2022). See: - new variable - https://github.com/OpenNebula/one/commit/e4d2cc11b9f3c6d01b53774b831f48d9d089c1cc - deprecation tracking issue - https://github.com/OpenNebula/one/issues/5536 Also, added support for SET_HOSTNAME context variable, which is currently widely used variable to configure guest VM hostname. See https://docs.opennebula.io/6.0/management_and_operations/references/template.html#context-section
2021-10-05integration-requirements: bump the pycloudlib commit (#1047)Paride Legovini
2021-10-04lp-to-git-users: adding vholer (#1044)Vlastimil Holer
Mapped from vlastimil-holer
2021-10-04Allow Vultr to set MTU and use as-is configs (#1037)eb3095
Add MTU, accept-ra, routes, options and a direct way to provide intact cloud configs for networking opposed to relying on configurations that may need changed often.
2021-09-30pin jsonschema in requirements.txt (#1043)James Falcon
On unit tests, tox is attempting to install 4.0, which fails two of the unit tests, and fails python 3.5 as it is not compatible.
2021-09-29testing: remove cloud_tests (#1020)James Falcon
Cloud tests have been replaced with integration tests
2021-09-29Add andgein as contributor (#1042)Andrew Gein
2021-09-29Make wording for module frequency consistent (#1039)Nicolas Bock
Some modules' frequency are documented as `always` while others as `per always`. The difference in wording can be confusing. This change updates all such modules to use `always`. Signed-off-by: Nicolas Bock <nicolas.bock@canonical.com>
2021-09-29Use ascii code for growpart (#1036)jshen28
growpart not working well for environment using UTF-8 encoding. This patch forces growpart command to use C locale. Root issue likely: https://bugs.launchpad.net/ubuntu/+source/cloud-utils/+bug/1928167
2021-09-29Add jshen28 as contributor (#1035)jshen28
2021-09-27Skip test_cache_purged_on_version_change on Azure (#1033)James Falcon
2021-09-24Remove invalid ssh_import_id from examples (#1031)James Falcon
2021-09-24Cleanup Vultr support (#987)eb3095
Offload Vultr's vendordata assembly to the backend, correct vendordata storage and parsing, allow passing critical data via the useragent, better networking configuration for additional interfaces.
2021-09-22docs: update cc_disk_setup for fs to raw disk (#1017)James Falcon
2021-09-22HACKING.rst: change contact info to James Falcon (#1030)James Falcon
2021-09-21tox: bump the pinned flake8 and pylint version (#1029)Paride Legovini
tox: bump the pinned flake8 and pylint version * pylint: fix W1406 (redundant-u-string-prefix) The u prefix for strings is no longer necessary in Python >=3.0. * pylint: disable W1514 (unspecified-encoding) From https://www.python.org/dev/peps/pep-0597/ (Python 3.10): The new warning stems form https://www.python.org/dev/peps/pep-0597, which says: Developers using macOS or Linux may forget that the default encoding is not always UTF-8. [...] Even Python experts may assume that the default encoding is UTF-8. This creates bugs that only happen on Windows. The warning could be fixed by always specifying encoding='utf-8', however we should be careful to not break environments which are not utf-8 (or explicitly state that only utf-8 is supported). Let's silence the warning for now. * _quick_read_instance_id: cover the case where load_yaml() returns None Spotted by pylint: - E1135 (unsupported-membership-test) - E1136 (unsubscriptable-object) LP: #1944414
2021-09-20Add retries to DataSourceGCE.py when connecting to GCE (#1005)vteratipally
Add retries to DatasourceGCE when connecting to GCE. Sometimes when the trying to fetch the metadata, cloud-init fails and the fallback datasource NoCloud is used which is not expected. Add retries to ensure loading of the data source.
2021-09-17Set Azure to apply networking config every BOOT (#1023)James Falcon
In #1006, we set Azure to apply networking config every BOOT_NEW_INSTANCE because the BOOT_LEGACY option was causing problems applying networking the second time per boot. However, BOOT_NEW_INSTANCE is also wrong as Azure needs to apply networking once per boot, during init-local phase.
2021-09-17Add connectivity_url to Oracle's EphemeralDHCPv4 (#988)James Falcon
Add connectivity_url to Oracle's EphemeralDHCPv4 On bionic, when trying to bring up the EphemeralDHCPv4, it's possible that we already have a route defined, which will result in an error when trying to add the DHCP route. Use the connectivity_url to check if we can reach the metadata service, and if so, skip the EphemeralDHCPv4. The has_url_connectivity function has also been modified to take a dict of kwargs to send to readurl. LP: #1939603
2021-09-17docs: fix typo and include sudo for report bugs commands (#1022)Renan Rodrigo
Remove a duplicate "a" in the docs, and change the bug reporting documentation to tell users to run the commands with sudo. LP: #1940236
2021-09-16VMware: Fix typo introduced in #947 and add test (#1019)PengpengSun
2021-09-16Update IPv6 entries in /etc/hosts (#1021)Richard Hansen
Add IPv6 localhost (::1) entry. See: https://salsa.debian.org/installer-team/netcfg/-/blob/1767c9264e04652b9150ffc7b25568e4ea6b2bdd/netcfg.h#L42 https://salsa.debian.org/md/netbase/-/blob/9de8afcad482418cc4956dc09bbf6a2e8624d574/debian/netbase.postinst#L8 Also remove ip6-localnet, ip6-mcastprefix, and ip6-allhosts. See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=499800 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=688090 LP: #1943798
2021-09-15Integration test upgrades for the 21.3-1 SRU (#1001)James Falcon
* Update test_combined.py to allow either valid LXD subplatform * Split jinja templated tests into separate module as they can be more fragile * Move checks for warnings and tracebacks into dedicated utility function. This allows us to work around persistent and expected tracebacks/warnings on particular clouds. * Update test_upgrade.py to allow either valid Azure datasource. /var/lib/waagent or a mounted device are both valid. * Add specificity to test_ntp_servers.py Clouds will often specify their own ntp servers in the ntp configuration files, so make the tests manually specify their own. * Account for additional keys on system in test_ssh_keysfiles.py * Update tests to account for invalid cache test_user_events.py and test_version_change.py both have tests that assume we will have valid ds cache when rebooting. In test_user_events.py, subsequent boots should block applying network on boot if boot event is denied. However, if the cache is invalid, it is valid to apply networking config that boot. In test_version_change.py no cache found won't trigger the expected debug log. Additionally, the pickle used for that test on an older release triggered an unexpected issue that took a different error path. * Ignore bionic in hotplug tests (LP: #1942247) On Bionic, we traceback when attempting to detect the hotplugged device in the updated metadata. This is because Bionic is specifically configured not to provide network metadata. See LP: #1942247 for more details. * Fix date used in test_final_message. In test_final_message, we ensured the variable substitution works as expected. For $timestamp, we compared against the current date. It's possible for the host date to be massively different from the client date, so obtain date on client rather than host. * Remove module success from lp1813396 test. Module may fail unrelatedly (in this case apt-get update is failing), but the test should still pass. * Skip testing events if network is disabled * Ensure we install expected version of cloud-init As part of test setup, we can install cloud-init from various sources, including PROPOSED, PPAs, etc. We were never checking that this install completes successfully, and on OCI, it wasn't completing successfully because of apt locking issues. Code has been updated to retry, and then fail loudly if we can't complete the install. * Remove ubuntu-azure-fips metapkg which mandates FIPS-flavour kernel In test_lp1835584.py * Update test_user_events.py to account for Azure behavior since Azure has a separate service to clear the pickled metadata every boot * Change failure to warning in test_upgrade.py if initial boot errors If there's already a pre-existing cause for warnings or tracebacks, that shouldn't cause the new version to fail. * Add retry to test_random_passwords_emitted_to_serial_console It's possible we haven't retrieved the entire log when the call returns, so retry a few times if the output isn't empty.
2021-09-14Add Jille to tools/.github-cla-signers (#1016)Jille Timmermans
2021-09-13Improve ug_util.py (#1013)Shreenidhi Shedi
No functional changes.
2021-09-13Support openEuler OS (#1012)zhuzaifangxuele
openEuler Homepage: https://www.openeuler.org/en/
2021-09-07ssh_utils.py: ignore when sshd_config options are not key/value pairs (#1007)Emanuele Giuseppe Esposito
As specified in #LP 1845552, In cloudinit/ssh_util.py, in parse_ssh_config_lines(), we attempt to parse each line of sshd_config. This function expects each line to be one of the following forms: \# comment key value key=value However, options like DenyGroups and DenyUsers are specified to *optionally* accepts values in sshd_config. Cloud-init should comply to this and skip the option if a value is not provided. Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
2021-09-03Set Azure to only update metadata on BOOT_NEW_INSTANCE (#1006)James Falcon
In #834, we refactored the handling of events for fetching new metadata. Previously, in Azure's __init__, the BOOT event was added to the update_events, so it was assumed that Azure required the standard BOOT behavior, which is to apply metadata twice every boot: once during local-init, then again during standard init phase. https://github.com/canonical/cloud-init/blob/21.2/cloudinit/sources/DataSourceAzure.py#L356 However, this line was effectively meaningless. After the metadata was fetched in local-init, it was then pickled out to disk. Because "update_events" was a class variable, the EventType.BOOT was not persisted into the pickle. When the pickle was then unpickled in the init phase, metadata did not get re-fetched because EventType.BOOT was not present, so Azure is effectely only BOOT_NEW_INSTANCE. Fetching metadata twice during boot causes some issue for pre-provisioning on Azure because updating metadata during re-provisioning will cause cloud-init to poll for reprovisiondata again in DataSourceAzure, which will infinitely return 404(reprovisiondata is deleted from IMDS after health signal was sent by cloud-init during init-local). This makes cloud-init stuck in 'init'
2021-09-02cc_update_etc_hosts: Use the distribution-defined path for the hosts file (#983)Andy Fiddaman
The distribution class has a field that specifies the location of the system hosts file and this can be overridden in subclasses. While the field is correctly used in distro.update_etc_hosts(), the update_etc_hosts module does not use it and just assumes '/etc/hosts' This fixes the module to use the distribution-specific variable.
2021-09-01Add CloudLinux OS support (#1003)Alexandr Kravchenko
https://www.cloudlinux.com/
2021-09-01puppet config: add the start_agent option (#1002)Andrew Bogott
The current code starts the puppet agent and also sets autostart in all cases. This conflicts with a common pattern where puppet itself manages the agent and autostart state. For example, in my deploy puppet disables the puppet agent and replaces it with a cron. This causes various races both within this cloud-init unit and within puppet itself while cloud-init and puppet fight over whether or not to enable the service.
2021-09-01Fix `make style-check` errors (#1000)Shreenidhi Shedi
Using flake8 inplace of pyflakes Renamed run-pyflakes -> run-flake8 Changed target name to flake8 in Makefile With pyflakes we can't suppress warnings/errors in few required places. flake8 is flexible in that regard. Hence using flake8 seems to be a better choice here. flake8 does the job of pep8 anyway. So, removed pep8 target from Makefile along with tools/run-pep8 script. Included setup.py in flake8 checks
2021-08-31Make cloud-id copyright year (#991)Andrii Podanenko
2021-08-30Add support to accept-ra in networkd renderer (#999)Shreenidhi Shedi
Also fix search path in networkd
2021-08-24Update ds-identify to pass shellcheck (#979)Andrew Kutz
This patch updates the ds-identify file to pass the popular shell linter, shellcheck. Updates include: * Global ignore for error code 3043, the warning about the "local" keyword not being POSIX compliant. This keyword is used everywhere and cannot be easily removed. * Point-of-use ignore for error code 3013, the warning about the "-nt" comparator not being POSIX compliant. There's no POSIX compliant way to compare timestamps on two files without forking a new process, so this comparator remains. * Several point-of-use ignores for error code 2254, the warning about quoting parameters. These warnings are ignored for the *_matches functions where wildcard tokens are expected to be used. Quoting the parameters would prevent the desired globbing and cause calls to these functions with wildcards to fail. * A point-of-use ignore for error code 2086 for the same reason as the above ignore -- allowing globbing to take place for matching. * Quoted parameters in the remainder of the locations where it was safe to do so and did not break the tests.
2021-08-24Azure: Retry dhcp on timeouts when polling reprovisiondata (#998)aswinrajamannar
In the nic attach path, we skip doing dhcp since we already did it when bringing the interface up. However when polling for reprovisiondata, it is possible for the request to timeout due to platform issues. In those cases we still need to do dhcp and try again since we tear down the context. We can only skip the first dhcp attempt.
2021-08-23testing: Fix ssh keys integration test (#992)James Falcon
Home directory permissions changed in hirsute. The integration test assumed permissions from earlier releases. Test was fixed to take both permissions into account
2021-08-23Release 21.3 (#993)James Falcon
Bump the version in cloudinit/version.py to 21.3 and update ChangeLog. LP: #1940839
2021-08-20Azure: During primary nic detection, check interface status continuously ↵aswinrajamannar
before rebinding again (#990) Add 10 second polling loop in wait_for_link_up after performing an unbind and re-bind of primary NIC in hv_netvsc driver. Also reduce cloud-init logging levels to debug for these operations.
2021-08-20Fix home permissions modified by ssh module (SC-338) (#984)James Falcon
Fix home permissions modified by ssh module In #956, we updated the file and directory permissions for keys not in the user's home directory. We also unintentionally modified the permissions within the home directory as well. These should not change, and this commit changes that back. LP: #1940233
2021-08-20Add integration test for sensitive jinja substitution (#986)James Falcon
Ensure jinja templates work for both instance-data.json and instance-data-sensitive.json. Test for LP: #1931392 Also removed test_runcmd.py as it's made redundant by this change.
2021-08-19Ignore hotplug socket when collecting logs (#985)James Falcon
Update "cloud-init collect-logs" to ignore /run/cloud-init/hook-hotplug-cmd as this will raise the error "/run/cloud-init/hook-hotplug-cmd` is a named pipe" if included. Also updated logs.py to continue writing the tarball if it fails collecting a file rather than let the exception bubble up. LP: #1940235
2021-08-19testing: Add missing mocks to test_vmware.py (#982)James Falcon
2021-08-16add Zadara Edge Cloud Platform to the supported clouds list (#963)sarahwzadara
2021-08-13testing: skip upgrade tests on LXD VMs (#980)James Falcon
The issues we see on Bionic VMs don't appear anywhere else, including when invoking kvm directly. It likely has to do with the extra LXD agent setup happening on bionic. Given that we still have Bionic covered on all other platforms, the risk of skipping bionic for LXD VM tests seems low.
2021-08-13Only invoke hotplug socket when functionality is enabled (#952)James Falcon
Alters hotplug hook to have a query mechanism checking if the functionality is enabled. This allows us to avoid using the hotplug socket and service when hotplug is disabled.
2021-08-13Revert unnecesary lcase in ds-identify (#978)Andrew Kutz
This patch reverts an unnecessary lcase optimization in the ds-identify script. SystemD documents the values produced by the systemd-detect-virt command are lower case, and the mapping table used by the FreeBSD check is also lower-case. The optimization added two new forked processes, needlessly causing overhead.
2021-08-12cc_resolv_conf: fix typos (#969)Shreenidhi Shedi
Add tests for cc_resolv_conf handler