From d51506109bfec2db727f52fe292b1ff507e07fa8 Mon Sep 17 00:00:00 2001 From: Tristan Cacqueray Date: Fri, 15 Nov 2024 09:59:41 -0500 Subject: [PATCH] Handle empty nodepool config --- zuul-capacity.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zuul-capacity.py b/zuul-capacity.py index e0537cc..50ea702 100644 --- a/zuul-capacity.py +++ b/zuul-capacity.py @@ -44,9 +44,9 @@ def get_providers(nodepool_yaml): "Get the cloud provider from the nodepool config." providers = dict() nodepool = yaml.safe_load(open(nodepool_yaml)) - for provider in nodepool["providers"]: - if provider["driver"] == "openstack": - providers[provider["name"]] = Provider.from_nodepool(provider) + for provider in nodepool.get("providers", []): + if provider.get("driver") == "openstack" and provider.get("cloud"): + providers[provider.get("name", "unknown")] = Provider.from_nodepool(provider) return providers def update_provider_metric(metrics, name, provider):