org.osbuild.cloud-init: add new datasources and network section

Adds WSL and NoCloud datasources. The network section only allows you to
disable network configuration by cloud-init for now.
This commit is contained in:
Sanne Raymaekers 2025-02-13 12:31:33 +01:00 committed by Achilleas Koutsou
parent 0e319018b6
commit 441fbf70d6
2 changed files with 33 additions and 0 deletions

View file

@ -93,6 +93,8 @@
"enum": [
"Azure",
"Ec2",
"NoCloud",
"WSL",
"None"
]
}
@ -136,6 +138,18 @@
"type": "string"
}
}
},
"network": {
"type": "object",
"minProperties": 1,
"properties": {
"config": {
"type": "string",
"enum": [
"disabled"
]
}
}
}
}
}

View file

@ -24,3 +24,22 @@ def test_cloud_init_datasource_list_single_line(tmp_path, stage_module):
stage_module.main(treedir, options)
assert os.path.exists(confpath)
assert confpath.read_text() == "datasource_list: [Azure]\n"
def test_cloud_init_network(tmp_path, stage_module):
treedir = tmp_path / "tree"
confpath = treedir / "etc/cloud/cloud.cfg.d/network.cfg"
confpath.parent.mkdir(parents=True, exist_ok=True)
options = {
"filename": confpath.name,
"config": {
"network": {
"config": "disabled",
},
},
}
stage_module.main(treedir, options)
assert os.path.exists(confpath)
assert confpath.read_text() == "network:\n config: disabled\n"