Commit Graph

664 Commits

Author SHA1 Message Date
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
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
Adrian Vladu 246db50591 nocloud: support for cloud-init network version 1
Added support for NoCloud service with Networking Config Version 1:
https://cloudinit.readthedocs.io/en/latest/topics/network-config-format-v1.html

Supported configuration types: Physical, Bond, Vlan and Nameserver.
Unsupported configuration types: Bridge, Route.

NoCloud metadata folder should contain a file network-config.
If no file is found, it falls back to using the contents for network-interfaces
key from the metadata file.

Example:

```yaml
version: 1
config:
   - type: physical
     name: interface0
     mac_address: "52:54:00:12:34:00"
     mtu: 1450
     subnets:
        - type: static
          address: 192.168.1.10
          netmask: 255.255.255.0
          dns_nameservers:
            - 192.168.1.11
   - type: bond
     name: bond0
     bond_interfaces:
       - gbe0
       - gbe1
     mac_address: "52:54:00:12:34:00"
     params:
       bond-mode: active-backup
       bond-lacp-rate: false
     mtu: 1450
     subnets:
        - type: static
          address: 192.168.1.10
          netmask: 255.255.255.0
          dns_nameservers:
            - 192.168.1.11
   - type: vlan
     name: vlan0
     vlan_link: eth1
     vlan_id: 150
     mac_address: "52:54:00:12:34:00"
     mtu: 1450
     subnets:
        - type: static
          address: 192.168.1.10
          netmask: 255.255.255.0
          dns_nameservers:
            - 192.168.1.11
   - type: nameserver
     address:
       - 192.168.23.2
       - 8.8.8.8
     search: acme.local
```

Change-Id: Idc413f6f9f001b2327c33a796e9ed494be28ce26
2020-07-01 19:08:47 +03:00
Zuul 5c3979e1ae Merge "Move ip_netmask_to_cidr to network utils" 2020-06-25 18:27:00 +00:00
Adrian Vladu 1e89827e4d Move ip_netmask_to_cidr to network utils
Move baseopenstackservice._ip_netmask_to_cidr to utils/network so that
it can be reused by other network parsers.

Change-Id: Iacca02cda75fd5d5b80f6200e7d2f26a3381b737
2020-06-24 16:55:19 +03:00
Adrian Vladu cbbcb98680 serialization: catch yaml and json errors
It is necessary to catch yaml and json errors that come from invalid
json / yaml streams like '{}}'.

Having an enumeration after a key value was set is a yaml parser error.

Change-Id: Ia8b298c3f1b36c6dee29326955d1e76ade3104b1
2020-06-24 16:33:10 +03:00
Adrian Vladu 58dfb24a6a Bump version to 1.1.3
Change-Id: I1c0f6ba00bf8504c6ee9108ad59f2c4ddce1233e
2020-06-22 18:48:39 +03:00
Adrian Vladu 1582ebec2c licensing: properly set KMS host and product key
If a trial license key was set, the KMS default product key and host was
not properly configured, as the execution of the licensing plugin ended
abruptly.

The fix is to set the kms and product key without checking the evaluation
date corresponding for the trial key.

Change-Id: I45e9364661208c454ddf2be0ff925d149fe0a6b0
2020-06-02 11:32:01 +03:00
Zuul d53e765b26 Merge "packet: add phone_home and post_password support" 2020-05-27 11:02:56 +00:00