Commit Graph

671 Commits

Author SHA1 Message Date
Adrian Vladu c88d0b9f11 github_actions: show tox logs
By default, the tox logs are not shown when ran in parallel.
Added tox flags to enable better log reading:

* --parallel-live
* --parallel-no-spinner

Change-Id: I706335c938ad4f75f14008ac3f3c055aa31945c1
Signed-off-by: Adrian Vladu <avladu@cloudbasesolutions.com>
2024-05-23 15:32:52 +03:00
Zuul 4c1550ba07 Merge "Add network config support to VMware guest info service" 2024-05-23 11:57:33 +00:00
Zuul 1adf31b1c9 Merge "Support alternate 'public-keys' format for NoCloud service." 2024-05-21 08:20:40 +00:00
Zhongcheng Lao f0fe66b30b Add network config support to VMware guest info service
This commit adds the network config support for VMware environment.
Both NetworkConfig V1 and V2 formats are supported to align with
cloud-init.

NetworkConfig V2 format specification can be found at
https://cloudinit.readthedocs.io/en/latest/reference/network-config-format-v2.html

Change-Id: I6c686a88be253858e9f46599f10dca571a76b85e
Signed-off-by: Zhongcheng Lao <zhongchengl@vmware.com>
2024-05-17 21:05:03 +08:00
Lukas Kranz 04c642408b Use MSFT_NetAdapter to rename adapter
Currently renaming the adapter on windows 22 core does not cause an error but also has no effect
INFO cloudbaseinit.plugins.common.networkconfig [-] Renaming network adapter "Ethernet" to "some-adapter-name"
...
ERROR cloudbaseinit.init cloudbaseinit.exception.ItemNotFoundException: Network interface with name "some-adapter-name" not found

Using Win32_NetworkAdapter or netsh for renaming network adapters does not work,
although they do not fail, but do no-operation (probably a Windows bug).

Fixes: https://github.com/cloudbase/cloudbase-init/issues/101

Change-Id: I6b05b313742dd6ff2553dd67b374a8aa4fefd0a7
Signed-off-by: Adrian Vladu <avladu@cloudbasesolutions.com>
2024-04-22 09:10:48 +03:00
Adrian Vladu c9eaf6a9b6 docs: update network config v1 document url
The current latest version of the cloud-init upstream
document URL has changed. Added the latest known good
version for the URL.

Change-Id: Ia2d48bea644a4d78fdf79792451a2f1d4c389f96
Signed-off-by: Adrian Vladu <avladu@cloudbasesolutions.com>
2024-04-04 18:05:56 +03:00
Zuul 4bb6895f11 Merge "winrmlistener: use sha2 instead of insecure sha1" 2024-03-27 09:43:59 +00:00
Zuul 2b1770d1d1 Merge "Replace the old UPPER_CONSTRAINTS_FILE env" 2024-03-25 13:43:31 +00:00
Luqman Aden 14900bc896 Support alternate 'public-keys' format for NoCloud service.
The 'public-keys' in the metadata is sometimes just a simple list of keys
instead of a list dicts with an 'openssh-key', e.g:

```yaml
instance-id: my-instance-id
local-hostname: my-host-name
public-keys:
  - ssh-rsa ...
```

Change-Id: I46c1228e1e1ea5bbf34144480633907a1ea20317
2024-03-20 19:36:31 +00:00
Adrian Vladu 036aa1641b readthedocs: add configuration file
readthedocs needs a configuration file with the
name .readthedocs.yaml.

See:
https://docs.readthedocs.io/en/stable/config-file/

Change-Id: I594cdb2650322222661b2069128fb4190052f37d
Signed-off-by: Adrian Vladu <avladu@cloudbasesolutions.com>
2024-03-04 14:25:17 +02:00
Takashi Kajinami 36ec0010f6 Replace the old UPPER_CONSTRAINTS_FILE env
... by the new TOX_CONSTRAINTS_FILE env, according to the changes made
in the OpenStack projects.

This also adds the constraints to the doc target, to avoid issues
caused by too new versions being pulled.

Change-Id: I3e99c1c24032cc3f4bc85ab07c28f830122beed4
2024-03-04 11:36:30 +00:00
Adrian Vladu a373d559e2 winrmlistener: use sha2 instead of insecure sha1
SHA1 is no longer secure and thus needs to be replaced by
a secure algorithm, in this case SHA256.

See:
https://en.wikipedia.org/wiki/SHA-1#Attacks

Fixes: https://github.com/cloudbase/cloudbase-init/issues/123

Change-Id: Ib565b99116fe966421f57b6c1f3bf6d6b9589288
Signed-off-by: Adrian Vladu <avladu@cloudbasesolutions.com>
2024-03-04 11:36:06 +00:00
Adrian Vladu 2ebfe19a88 requirements: add missing pytz package
`pytz` package was included by oslo.log dependency on
oslo.serialization.
Recently, this commit removed the pytz package for
Python versions >= 3.9:
9aaea368e4

Which means `pytz` needs to be added as a requirement to
be able to support the current mainline Python 3.11.

Change-Id: I3dadbe0ead2369565afd7b7feed7761ff4a7db57
Signed-off-by: Adrian Vladu <avladu@cloudbasesolutions.com>
2024-03-04 13:01:54 +02:00
Adrian Vladu 07cae6e8c7 github_actions: add windows and functional testing
- add Linux unit testing for Python 3.8 and 3.11 (x64)
 - add Windows unit testing for Python 3.8 and 3.11 (x64 and x86)
 - add Windows functional testing for Python 3.11 (x64 and x86)

Change-Id: If4ca5a10f62e320c598f0bac7e1ec2ec52862c21
2023-11-10 15:00:33 +02:00
Adrian Vladu 6b2372d169 python 3.11: run tests on github and opendev
Change-Id: Ida8a2ea553ac006684a4fc796600ef7ea42f8d79
2023-11-09 15:41:53 +02:00
Adrian Vladu 0fded69cb3 replace unittest.mock._get_target with mock one
Use the original importer for mock. Otherwise, the unit tests that
use importlib with context are not running in an isolated manner,
leading to various transient failures if `stestr` is not run with the
`--isolated` flag.

The unittest.mock._get_target has been changed in Python 3.11, by commit:
ab7fcc8fbd

This change is needed to add support for Python 3.11 and Python 3.12
unit testing.

Change-Id: Ic73f5280116673f771f5460cdfd3702f5fbe16b5
2023-11-09 15:39:45 +02:00
Zuul 36ed936803 Merge "use instance_id as string for plugin sections" 2023-10-16 14:05:01 +00:00
Zuul 983e1482e6 Merge "Accept drives with vFAT label 'cidata' as a configdrive." 2023-10-16 14:04:28 +00:00
Adrian Vladu 86adb2ce57 use instance_id as string for plugin sections
If `instance_id` is set in the metadata as an integer, cast it as a
string when used to uniquely identify plugin sections.

Fixes-Bug: https://github.com/cloudbase/cloudbase-init/issues/124

Change-Id: I3a9335fb3885c5f3191051aaaeeec94f89a6b89a
2023-10-12 17:09:05 +03:00
Adrian Vladu 102cd5a37c github_mirror: update ssh secret name
The zuul post action seems to not be using the code it just merged, so a
new commit is necessary for the post action code to be used.

Similar to:
https://review.opendev.org/c/starlingx/update/+/879489

Change-Id: I8bd708a08678507f07737f6e3909a93898494682
2023-09-12 12:58:05 +03:00
Adrian Vladu 05266a4c22 github_mirror: update ssh-rsa public key
Update github.com rsa ssh host key as per:
https://github.blog/2023-03-23-we-updated-our-rsa-ssh-host-key/

Change-Id: I637452985d16bf159f5719c11c7226bf1a8649c3
2023-09-06 15:24:08 +03:00
Adrian Vladu a147363855 github_actions: run python tox on commit / pull
Use github action ubuntu-22.04 environment to install tox and then run
all tox envs defined in the tox.ini

Change-Id: I7f91314a2b9cd276e63cf2158100795c6bfc8ff3
2023-08-22 10:43:59 +03:00
Luqman Aden 9b17eaf1d4 Accept drives with vFAT label 'cidata' as a configdrive.
Match vFAT label using a given label instead of hardcoding 'config-2'.

The NoCloud and ConfigDrive metadata services both attempt to find vFAT
formatted drives but the label used was hardcoded to 'config-2' which
only works with ConfigDrive. BaseConfigDriveService which both inherit
from already has a drive_label property set appropriately for both so
let's use that for the vFAT finding logic as well.

Change-Id: I8004a8565338b0615450bb28cecc86901be94766
2023-05-14 06:32:55 +00:00
Adrian Vladu 912eea88ed Bump version to 1.1.5
Change-Id: I0206bf572d251e4d7b2fb01a62f148e19d2de6a6
2023-02-14 17:30:02 +02:00
Adrian Vladu 1a28d39c72 bsdtar: check if tool path exists
Check if the configuration value of bsdtar_path does exist as a path
before trying to execute the binary.

Updated the tutorial reference of bsdtar to FreeBSD instead of Ubuntu.

Change-Id: Ieba5da2f330aa11c40cce6c2ae9de40155f33b07
2023-01-19 14:52:49 +02:00
Adrian Vladu e09af5f15b tox: fix py3 / docs gates
Bump version of tox to 4.02 and add requirements for the docs.

Change-Id: Ib4131d1278d742a4730935240b59e6b0e3d94555
2023-01-18 16:05:56 +02:00
Adrian Vladu ea5e8da627 crypto: replaced openssl with cryptography module
Use cryptography instead of the flaky openssl libraries loading.
If the libssl DLLs were not present or were present in another order
then the required one, there could be errors when securing the password
before sending it to the metadata service.

Fixes: https://github.com/cloudbase/cloudbase-init/issues/34

Change-Id: I1a2245e199f65f4665071ada9576dcae77a3a432
2022-12-12 14:22:56 +02:00
Zuul 576db310c2 Merge "cloudconfig: fix type in key name no_create_home" 2022-12-07 15:26:14 +00:00
Zuul 9198d0ba38 Merge "Retry user load profile on Windows" 2022-12-07 15:17:29 +00:00
Adrian Vladu cae4135e3b cloudconfig: fix type in key name no_create_home
User cloudconfig plugin had a typo in the key: "no_create_home"
Change-Id: Ia8261dfcc8dc5d817d351735c77cc87db76be8f0
2022-12-07 17:05:57 +02:00
Adrian Vladu da0c0dc7bd crypt: use the py3 builtin openssl
With Python 3.7+, the Python installer has the libcrypto and libssl dlls
in the DLLs Python folder, namely libcrypto-1_1.dll and libssl-1_1.dll,
which can be used directly.

Change-Id: I245c377dc8a9ec9a2e8548806bacd757bfdf27b6
2022-12-07 00:42:59 +02:00
Adrian Vladu 072bee9c5d xml: force return of unicode string
With Python 3.8, the xml.etree.ElementTree.ElementTree function now
preserves the attribute order specified by the user.

This change broke the winrm enable functionality, throwing the erorr:

```
TypeError: Objects of type 'bytes' can not be converted to Unicode.
```

The fix was to set the correct parameter to return an unicode string and
not bytes.

Change-Id: I10f7fa357267f36dfed03ccb708694f6fc1cdd97
2022-11-21 20:13:23 +02:00
Adrian Vladu e192f67f71 version: bump version to 1.1.4
Version 1.1.4+ does not support Python 3.7 or lower anymore.

Change-Id: I9f5de3b058f0dc31e7e09a334f23f92f7e7ed907
2022-11-21 13:29:10 +02:00
Zuul d6e28339eb Merge "azureservice: added redundance for wireserver" 2022-09-20 22:59:45 +00:00
Adrian Vladu 4a9d260a95 bump untangle to version 1.2.1
Bump untangle package version from 1.1.1 to 1.2.1

Change-Id: I1aa386c6dd5c02e6bc5046899980935a22dc1526
2022-09-19 13:46:53 +03:00
Adrian Vladu 888e1b4602 azureservice: added redundance for wireserver
* Added more retries for wireserver discovery
* Added logging to wireserver discovery errors
* Fallback to the well known wireserver IP in case of discovery failure

Github Issue: https://github.com/cloudbase/cloudbase-init/issues/94

Change-Id: I91460f9ad674294a83c9b3c3f05bc04ab61de56f
2022-09-08 12:48:39 +03:00
Adrian Vladu 1a32d738de opendev: bumped gates to python 3.9/3.10
Python 3.6/3.7 are no longer supported for the latest releasese of
the OpenStack packages like oslo or coverage, thus switching to the Zed
OpenStack release gates, which have support for 3.8/3.9/3.10 Python
versions.

For gates to pass, the docs required a defined language to be set ("en"),
while the crypto unit tests required a method signature fix when running
on Python 3.9/3.10.

The version test__check_latest_version* unit tests started failing
in a transient pattern because of the
pbr.version.VersionInfo().release_string() throwing the following error:
"NotImplementedError: cannot instantiate 'WindowsPath' on your system".
This required to have the cloudbaseinit.version.get_version mocked for a
reliable unit test run on Linux.

Change-Id: I4748d1258c072c377825474e1116347b0a085c56
2022-09-07 20:26:34 +03:00
Adrian Vladu f8479e5cbc Continue execution on volume extension failure
When a small amount of disk space remains to be extended,
the 'Virtual Disk Service' can fail with
VDS_E_EXTENT_SIZE_LESS_THAN_MIN error code.

This happens on environments where a volume has already been extended
and there is a small amount of bytes that somehow remain residual after
the initial extension.

Change-Id: I072ed568ef1f2790e95851b45afb8ffcc0acce0e
2021-10-18 17:17:25 +03:00
Zuul 300dabb36e Merge "windows: network: fix DHCP setting" 2021-09-14 10:10:29 +00:00
Adrian Vladu 8a6f478aad windows: network: fix DHCP setting
Fixed Windows osutils DHCP setting, as the former implementation that
used registry keys was no reliable. Using MSFT_NetIPInterface should fix
any reliability issues.

Change-Id: I94cf70b092da706cdfaf57bc78d7b266064b97b0
2021-09-14 12:29:38 +03:00
Adrian Vladu 2f4f315e20 jinja2: remove usage of runtime string decorator
Change-Id: I5b19c7ad798f490031b29b99ecc43d417e1a1a21
2021-07-07 14:36:17 +03:00
yoerg 39e2f6faf4 Support retrieving admin_username from OpenStack metadata
Allows giving an instance an individual cloud username, e.g. for license servers, while still retrieving SSH public keys for that user from OpenStack.

Change-Id: I078380ef8f74b30105fd44378045df8b1260acbc
2021-01-20 12:05:11 +01:00
Adrian Vladu a9ffc62c11 Retry user load profile on Windows
On Windows, the load user profile may fail on laggy systems, if the
Windows subsystems are not ready at that moment.

Retrying the load should fix the issue most of the times.

Change-Id: I28cc564ebeac6d901dcbbef7cebe882a5ccb41b1
2021-01-13 13:04:26 +02:00
Zuul 97295ba569 Merge "Retry netlbfo team creation" 2020-12-04 12:58:36 +00:00
Adrian Vladu ab342fc493 Retry netlbfo team creation
The WMI implementation for NETLBFO is sometimes flaky and does not fail
when a bond cannot be created.

Added 5 retries for the team creation, just in case the WMI call to
create the bond did not fail, but the bond was not created.

In this scenario, the _wait_for_nic method is called and it fails,
as it does not find the team nic and the retry is performed.

Updated the wait for team nic retry interval to 10 seconds,
as the team nic may be retrieved with WMI after a longer time.

Change-Id: I7622a4a30b867f335ed8f3288ca2fea830daf94b
2020-11-03 16:27:56 +02:00
Zuul 289ddbd4dd Merge "Removed unused requirement 'eventlet'" 2020-10-01 10:20:33 +00:00
Adrian Vladu b97c36f478 Removed unused requirement 'eventlet'
eventlet is a Python requirement that is no longer used in the current
codebase.

Change-Id: Ic2f5ba7baa5fe0088bf304c94b8427cd26e5e06f
2020-10-01 12:40:05 +03:00
Adrian Vladu 27d6fd01d6 opennebula: fix shell variables parsing
Fix parsing of the empty values written as:

KEY=""
KEY=''

Change-Id: I56ea03da5d78c01af2647444b825bf63d5146137
2020-10-01 09:25:28 +00:00
Adrian Vladu 28f4fbbd45 Fix Python 3 unit tests
Removed the functools partial from being mocked, as it is used
internally in the mocking implementation and generates unit test error.

Updated tox / unit test requirements according to new OpenStack gate
requirements.

Updating the tox requirements added a new set of flakes rules that had
to be skipped for now, which will be addressed in upcoming patches.

Change-Id: I231ca3b15313541e2c43785e80d9db5659aa1cc3
2020-09-30 15:14:05 +03:00
Adrian Vladu 3c290194c1 Remove support and automated checks for Python 2.x
As Python 2 has reached EOL, is time to remove the declarative support
for it. This code snapshot still supports Python 2.7, but in the future,
no Python 2.x tests will be performed to ensure the support.

Change-Id: Ic8fe6b958d658ae25f887179ab5900e13c88af54
2020-07-13 11:42:17 +03:00