canonical / canonical/cloud-init
ds-identify yaml parsing is broken
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 1.1k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 18
Description
# Bug report
Any call to `check_config()` in `ds-identify` is subtly broken, and could result in false positives as a result of this key in `/etc/cloud/cloud.cfg` or `/etc/cloud/cloud.cfg/.d*`. The most impactful use of this false positive can result in the false positive detection of MAAS as the datasource.
For example, the following configuration:
```yaml
datasource:
MAAS:
metadata_urls: [ 'blah.com' ]
```
Will result in MAAS being detected, even if it is not the correct platform.
```bash
# cat /run/cloud-init/cloud.cfg
datasource_list: [ MAAS, LXD, None ]
```
This may impact users that excpect to use a single configuration for multiple datasources, by causing cloud-init to attempt detection of maas at runtime:
```python
2024-01-23 19:59:14,496 - __init__.py[DEBUG]: Looking for data source in: ['MAAS', 'LXD', 'None'], via packages ['', 'cloudinit.sources'] that matches dependencies ['FILESYSTEM']
2024-01-23 19:59:14,499 - __init__.py[DEBUG]: Searching for local data source in: ['DataSourceMAAS', 'DataSourceLXD']
2024-01-23 19:59:14,499 - handlers.py[DEBUG]: start: init-local/search-MAAS: searching for local data from DataSourceMAAS
2024-01-23 19:59:14,499 - __init__.py[DEBUG]: Seeing if we can get any data from
2024-01-23 19:59:14,500 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: boot-new-instance
2024-01-23 19:59:14,500 - __init__.py[DEBUG]: Detected platform: DataSourceMAAS [None]. Checking for active instance data
2024-01-23 19:59:14,500 - __init__.py[DEBUG]: Datasource DataSourceMAAS [None] not updated for events: boot-new-instance
2024-01-23 19:59:14,500 - handlers.py[DEBUG]: finish: init-local/search-MAAS: SUCCESS: no local data found from DataSourceMAAS
2024-01-23 19:59:14,500 - handlers.py[DEBUG]: start: init-local/search-LXD: searching for local data from DataSourceLXD
```
Contributor guide
Assessment
This issue has not been assessed yet.