From ae90be1d7088e982dc69a494a99080ff8f1f5d9c Mon Sep 17 00:00:00 2001 From: Artem Goncharov Date: Wed, 6 Nov 2024 14:26:23 +0100 Subject: [PATCH] Restore generating image service code Hotfix schemas sanitizing the locations added stuff. Change-Id: Iddfcebd89f80978d4e674ff7677defce26d6af53 --- codegenerator/openapi/glance.py | 15 ++++++++++++++- zuul.d/rust.yaml | 8 +++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/codegenerator/openapi/glance.py b/codegenerator/openapi/glance.py index d029cf5..fb4903d 100644 --- a/codegenerator/openapi/glance.py +++ b/codegenerator/openapi/glance.py @@ -262,7 +262,7 @@ class GlanceGenerator(OpenStackServerSourceBase): proc.start() proc.join() if proc.exitcode != 0: - raise RuntimeError("Error generating Glance OpenAPI schma") + raise RuntimeError("Error generating Glance OpenAPI schema") return Path(target_dir, "openapi_specs", "image", "v2.yaml") def _generate(self, target_dir, args): @@ -720,10 +720,23 @@ class GlanceGenerator(OpenStackServerSourceBase): elif name == "ImageShowResponse": for field in i32_fixes: res["properties"][field]["format"] = "int64" + elif name in [ + "ImagesLocationsGet_LocationsResponse", + "ImagesLocationsAdd_LocationResponse", + ]: + if "locations" in res["properties"]: + res = res["properties"]["locations"] + elif name == "ImagesLocationsAdd_LocationRequest": + if "locations" in res["properties"]: + res = res["properties"]["locations"]["items"] elif name == "MetadefsNamespacesPropertiesListResponse": res["properties"]["properties"]["additionalProperties"][ "type" ] = "object" + + if res["type"] == "object": + res.pop("name", None) + res.pop("links", None) return TypeSchema(**res) @classmethod diff --git a/zuul.d/rust.yaml b/zuul.d/rust.yaml index 460e13f..5199327 100644 --- a/zuul.d/rust.yaml +++ b/zuul.d/rust.yaml @@ -24,11 +24,9 @@ - service: "identity" metadata: "metadata/identity_metadata.yaml" targets: ["rust-sdk", "rust-cli"] - # https://review.opendev.org/c/openstack/glance/+/882498 screwed us. - # Disable build for glance until we find way to deal with that - # - service: "image" - # metadata: "metadata/image_metadata.yaml" - # targets: ["rust-sdk", "rust-cli"] + - service: "image" + metadata: "metadata/image_metadata.yaml" + targets: ["rust-sdk", "rust-cli"] - service: "load-balancer" metadata: "metadata/load-balancer_metadata.yaml" targets: ["rust-sdk", "rust-cli"]