From a02ec0a495971256674d9386ee34bba11d444e5c Mon Sep 17 00:00:00 2001 From: "Mclean, Aaron (am9518)" Date: Thu, 6 Sep 2018 22:14:09 -0500 Subject: [PATCH] [DE578849] empty quotas showing for unset quotas Change-Id: I3f9c2afd205119b440e34fed44af46c1e5f34e29 --- .../cms_rest/data/sql_alchemy/models.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/orm/services/customer_manager/cms_rest/data/sql_alchemy/models.py b/orm/services/customer_manager/cms_rest/data/sql_alchemy/models.py index bac388b2..e0aa8f9f 100755 --- a/orm/services/customer_manager/cms_rest/data/sql_alchemy/models.py +++ b/orm/services/customer_manager/cms_rest/data/sql_alchemy/models.py @@ -227,12 +227,23 @@ class CustomerRegion(Base, CMSBaseModel): type = self.region.type quota = [] quotas = {} + + # The WSME can't handle existing data and shows empty values for unset new quotas + for class_name, class_value in WsmeModels.__dict__.iteritems(): + if str(class_name) in "Network, Storage, Compute": + quotas[str(class_name).lower()] = {} + for field_key in dir(class_value): + if not field_key.startswith('__') and not field_key.startswith('_') \ + and not callable(getattr(class_value, field_key)): + # unset all possible quotas. + quotas[str(class_name).lower()][field_key] = wsme.Unset + for region_quota in self.customer_region_quotas: - quotas[region_quota.quota_type] = {} + # quotas[region_quota.quota_type] = {} for quota_field in region_quota.quota_field_details: quotas[region_quota.quota_type][quota_field.field_key] = quota_field.field_value or wsme.Unset - if quotas: + if self.customer_region_quotas: compute = None storage = None network = None