summaryrefslogtreecommitdiff
path: root/tests/unittests/sources/test_scaleway.py
Commit message (Collapse)AuthorAgeFilesLines
* Adapt DataSourceScaleway to upcoming IPv6 support (#2033)Louis Bouchard2023-04-051-119/+554
| | | | | | | | | | | | | | | | | | | Add support for IPv4 and/or IPv6 provided metadata. Upcoming features will allow for Instances to be started with only IPv6 connectivity. The datasource must be able to fetch its metadata from the following endpoints : * IPv4 on http://169.264.42.42/conf * IPv6 on http://[fd00:42::42]/conf This URL may eventually be overridden in the future by a DNS resolvable URL defined in /etc/cloud/config.d/scaleway.conf Add support for the configuration of one or many IP addresses when provided by the `public_ips` metadata key. In such configurations, instances no longer have a `private_ip`. The previous configuration method is kept for backward compatibility. This commit also fixes a bug in the definition of ssh keys from tags.
* datasource: Optimize datasource detection, fix bugs (#2060)Brett Holman2023-03-191-10/+21
| | | | | | | | | | | | | | | | | | Commit d1ffbea556a06105 enabled skipping python datasource detection on OpenStack when no other datasources (besides DataSourceNone) can be discovered. This allowed one to override detection, which is a requirement for OpenStack Ironic which does not advertise itself to cloud-init. Since no further datasources can be detected at this stage in the code, this pattern can be generalized to other datasources to facilitate troubleshooting or providing a general workaround to runtime detection bugs. Additionally, this pattern can be extended to kernel commandline datasource definition. Since kernel commandline is highest priority of the configurations, it makes sense to override python code datasource detection as well. Include an integration test on LXD for this behavior that configures kernel commandline and reboots to verify that the specified datasource is forced.
* tests: Drop httpretty in favor of responses (#1720)Alberto Contreras2022-09-191-41/+61
|
* Refactor: Drop inheritance from object (#1728)Alberto Contreras2022-09-141-2/+2
| | | As we do not support python2 anymore, we can remove those 8 chars.
* net: Ensure a tmp with exec permissions for dhcp (#1690)Alberto Contreras2022-09-011-1/+3
| | | | | | | | In the case cloudinit.temp_utils points to a fs mounted as noexec and needs_exe=True, fallback to use os.join.path(Distro.usr_lib_exec, "cloud-init/clouddir) that will be mounted with exec perms. LP: #1962343
* cc_set_hostname: do not write "localhost" when no hostname is given (#1453)Emanuele Giuseppe Esposito2022-05-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Systemd used to sometimes ignore localhost in /etc/hostnames, and many programs like cloud-init used this as a workaround to set a default hostname. From https://github.com/systemd/systemd/commit/d39079fcaa05e23540d2b1f0270fa31c22a7e9f1: We would sometimes ignore localhost-style names in /etc/hostname. That is brittle. If the user configured some hostname, it's most likely because they want to use that as the hostname. If they don't want to use such a hostname, they should just not create the config. Everything becomes simples if we just use the configured hostname as-is. This behaviour seems to have been a workaround for Anaconda installer and other tools writing out /etc/hostname with the default of "localhost.localdomain". Anaconda PR to stop doing that: rhinstaller/anaconda#3040. That might have been useful as a work-around for other programs misbehaving if /etc/hostname was not present, but nowadays it's not useful because systemd mostly controls the hostname and it is perfectly happy without that file. Apart from making things simpler, this allows users to set a hostname like "localhost" and have it honoured, if such a whim strikes them. As also suggested by the Anaconda PR, we need to stop writing default "localhost" in /etc/hostnames, and let the right service (networking, user) do that if they need to. Otherwise, "localhost" will permanently stay as hostname and will prevent other tools like NetworkManager from setting the right one. Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> RHBZ: 1980403
* Scaleway: Fix network configuration for netplan 0.102 and later (#1455)Maxime Corbin2022-05-161-1/+7
| | | | Since version 0.102 netplan no longer supports the option `gateway6`. This commit changes this option to the newer `routes` one.
* Adopt Black and isort (SC-700) (#1157)James Falcon2021-12-151-214/+267
| | | | | Applied Black and isort, fixed any linting issues, updated tox.ini and CI.
* Reorganize unit test locations under tests/unittests (#1126)Brett Holman2021-12-031-0/+473
This attempts to standardize unit test file location under test/unittests/ such that any source file located at cloudinit/path/to/file.py may have a corresponding unit test file at test/unittests/path/to/test_file.py. Noteworthy Comments: ==================== Four different duplicate test files existed: test_{gpg,util,cc_mounts,cc_resolv_conf}.py Each of these duplicate file pairs has been merged together. This is a break in git history for these files. The test suite appears to have a dependency on test order. Changing test order causes some tests to fail. This should be rectified, but for now some tests have been modified in tests/unittests/config/test_set_passwords.py. A helper class name starts with "Test" which causes pytest to try executing it as a test case, which then throws warnings "due to Class having __init__()". Silence by changing the name of the class. # helpers.py is imported in many test files, import paths change cloudinit/tests/helpers.py -> tests/unittests/helpers.py # Move directories: cloudinit/distros/tests -> tests/unittests/distros cloudinit/cmd/devel/tests -> tests/unittests/cmd/devel cloudinit/cmd/tests -> tests/unittests/cmd/ cloudinit/sources/helpers/tests -> tests/unittests/sources/helpers cloudinit/sources/tests -> tests/unittests/sources cloudinit/net/tests -> tests/unittests/net cloudinit/config/tests -> tests/unittests/config cloudinit/analyze/tests/ -> tests/unittests/analyze/ # Standardize tests already in tests/unittests/ test_datasource -> sources test_distros -> distros test_vmware -> sources/vmware test_handler -> config # this contains cloudconfig module tests test_runs -> runs