From 45929efbcfd5aa7a959626d94a032ca9b21ef217 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Tue, 3 Jun 2025 17:20:51 +0200 Subject: [PATCH] cloudapi: validate Disk customization before returining After converting a Disk customization from the API type to the Blueprint equivalent, run the validator and return an error if it fails to validate. The schema doesn't catch all invalid cases, such as the mountpoint being required when the fs_type is not "swap", so calling the validator ensures that any such cases are caught without needing to duplicate the checks. --- internal/cloudapi/v2/compose.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/cloudapi/v2/compose.go b/internal/cloudapi/v2/compose.go index e3b9a7632..eae2493d4 100644 --- a/internal/cloudapi/v2/compose.go +++ b/internal/cloudapi/v2/compose.go @@ -1433,7 +1433,7 @@ func convertDiskCustomizations(disk *Disk) (*blueprint.DiskCustomization, error) } bpDisk.Partitions = append(bpDisk.Partitions, bpPartition) } - return bpDisk, nil + return bpDisk, bpDisk.Validate() } func decodeMinsize(size *Minsize) (uint64, error) {