diff options
author | Brett Holman <brett.holman@canonical.com> | 2023-02-06 06:19:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-06 14:19:32 +0100 |
commit | ce78c1bf13e41af20e28635a3e2326d5aa4d2469 (patch) | |
tree | 8ae2dced63c71a4cc846e173f9417d6c545b9f07 | |
parent | 51fef28bc561ca688308ac6ae060fa315e1c2d90 (diff) | |
download | cloud-init-git-ce78c1bf13e41af20e28635a3e2326d5aa4d2469.tar.gz |
schema: fix gpt labels, use type string for GUID (#1995)
LP #2004599
-rw-r--r-- | cloudinit/config/schemas/schema-cloud-config-v1.json | 9 | ||||
-rw-r--r-- | tests/unittests/config/test_cc_disk_setup.py | 24 |
2 files changed, 30 insertions, 3 deletions
diff --git a/cloudinit/config/schemas/schema-cloud-config-v1.json b/cloudinit/config/schemas/schema-cloud-config-v1.json index 67482cb9..d227e159 100644 --- a/cloudinit/config/schemas/schema-cloud-config-v1.json +++ b/cloudinit/config/schemas/schema-cloud-config-v1.json @@ -1144,7 +1144,14 @@ { "type": "array", "items": { - "type": "integer" + "anyOf": [ + { + "type": "integer" + }, + { + "type": "string" + } + ] }, "minItems": 2, "maxItems": 2 diff --git a/tests/unittests/config/test_cc_disk_setup.py b/tests/unittests/config/test_cc_disk_setup.py index 70085314..5fa7d4cd 100644 --- a/tests/unittests/config/test_cc_disk_setup.py +++ b/tests/unittests/config/test_cc_disk_setup.py @@ -321,5 +321,25 @@ class TestDebugSchema: with pytest.raises(SchemaValidationError, match=error_msg): validate_cloudconfig_schema(config, schema, strict=True) - -# vi: ts=4 expandtab + @pytest.mark.parametrize( + "config", + ( + ( + { + "disk_setup": { + "/dev/disk/by-id/google-home": { + "table_type": "gpt", + "layout": [ + [100, "933AC7E1-2EB4-4F13-B844-0E14E2AEF915"] + ], + } + } + } + ), + ), + ) + @skipUnlessJsonSchema() + def test_valid_schema(self, config): + """Assert expected schema validation and no error messages.""" + schema = get_schema() + validate_cloudconfig_schema(config, schema, strict=True) |