diff --git a/stages/org.osbuild.ovf.meta.json b/stages/org.osbuild.ovf.meta.json index 6799a06f..1f0fe8ce 100644 --- a/stages/org.osbuild.ovf.meta.json +++ b/stages/org.osbuild.ovf.meta.json @@ -40,7 +40,8 @@ "default": "OtherLinux_64" }, "mac_address": { - "type": "string" + "type": "string", + "pattern": "^[a-fA-F0-9]{12}$" } } } diff --git a/stages/test/test_ovf.py b/stages/test/test_ovf.py index 189cc97a..9285e63f 100644 --- a/stages/test/test_ovf.py +++ b/stages/test/test_ovf.py @@ -15,6 +15,8 @@ STAGE_NAME = "org.osbuild.ovf" ({"vmdk": "imagename"}, "'imagename' does not match '[a-zA-Z0-9+_.-]+.vmdk'"), ({"vmdk": "imagename.vmdk", "vmware": {"os_type": 1}}, "is not of type 'string'"), ({"vmdk": "imagename.vmdk", "virtualbox": {"os_type": 1}}, "is not of type 'string'"), + ({"vmdk": "imagename.vmdk", "virtualbox": {"mac_address": 1}}, "is not of type 'string'"), + ({"vmdk": "imagename.vmdk", "virtualbox": {"mac_address": "1"}}, "'1' does not match '^[a-fA-F0-9]{12}$'"), # Good API parameters ({"vmdk": "imagename.vmdk"}, ""), ({"vmdk": "imagename.vmdk", "vmware": {"os_type": "OtherGuest"}, "virtualbox": {"os_type": "OtherGuest"}}, ""), @@ -46,7 +48,7 @@ def test_schema_validation_ovf(stage_schema, test_data, expected_err): # Replacements ({"vmware": {"os_type": "my-vmware-os-type"}}, ["my-vmware-os-type"],), ({"virtualbox": {"os_type": "my-vbox-os-type"}}, ["my-vbox-os-type"],), - ({"virtualbox": {"mac_address": "my-mac-address"}}, ["my-mac-address"],), + ({"virtualbox": {"mac_address": "000000000000"}}, ["000000000000"],), ]) def test_ovf_default_template(tmp_path, stage_module, test_opts, expected_substrings): faked_vmdk_path = tmp_path / "some-image.vmdk"