Skip to content

Commit

Permalink
Use a default quotaclass if none is set (#151)
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Berendt <berendt@osism.tech>
  • Loading branch information
berendt committed Dec 5, 2023
1 parent 2f37dae commit 6ebb7da
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
features:
- |
Use a default for `quotaclass` if none has been set.
14 changes: 10 additions & 4 deletions src/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down Expand Up @@ -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)
Expand All @@ -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")
Expand Down

0 comments on commit 6ebb7da

Please sign in to comment.