From 6ebb7da27e77c296f9558ceea4bd973613bac1db Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Tue, 5 Dec 2023 16:45:23 +0100 Subject: [PATCH] Use a default quotaclass if none is set (#151) Signed-off-by: Christian Berendt --- .../use-default-quota-class-73e28b2c6f12fa63.yaml | 4 ++++ src/manage.py | 14 ++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/use-default-quota-class-73e28b2c6f12fa63.yaml diff --git a/releasenotes/notes/use-default-quota-class-73e28b2c6f12fa63.yaml b/releasenotes/notes/use-default-quota-class-73e28b2c6f12fa63.yaml new file mode 100644 index 0000000..7796261 --- /dev/null +++ b/releasenotes/notes/use-default-quota-class-73e28b2c6f12fa63.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + Use a default for `quotaclass` if none has been set. diff --git a/src/manage.py b/src/manage.py index 95970f6..c6b8121 100755 --- a/src/manage.py +++ b/src/manage.py @@ -104,8 +104,10 @@ def check_quota(project, cloud): quotaclass = get_quotaclass("service") elif project.name == "admin": quotaclass = get_quotaclass("admin") - else: + elif "quotaclass" in project: quotaclass = get_quotaclass(project.quotaclass) + else: + quotaclass = get_quotaclass("basic") if quotaclass: logger.info(f"{project.name} - quotaclass {project.quotaclass}") @@ -755,9 +757,13 @@ def process_project(project, domain): if "unmanaged" in project: logger.warning(f"{project.name} - not managed --> skipping") - elif "quotaclass" not in project: - logger.warning(f"{project.name} - quotaclass not set --> skipping") else: + if "quotaclass" in project: + quotaclass = project.quotaclass + else: + logger.warning(f"{project.name} - quotaclass not set --> use default") + quotaclass = "basic" + domain = cloud.get_domain(project.domain_id) check_quota(project, cloud) @@ -774,7 +780,7 @@ def process_project(project, domain): share_images(project, domain) if ( - project.quotaclass not in ["default", "service"] + quotaclass not in ["default", "service"] and "managed_network_resources" in project ) or ( check_bool(project, "is_service_project")