Commit 6b5d0e1e authored by Giorgos Korfiatis's avatar Giorgos Korfiatis Committed by Christos Stavrakakis
Browse files

astakos: Preserve visibility flags on register

When re-registering an existing resource, do not override the visibility
flags. They may have been modified by the administrator.

Also fix field naming in resource-list.
parent 1ac09fd7
......@@ -51,8 +51,9 @@ class Command(ListCommand):
FIELDS = {
"id": ("id", "ID"),
"name": ("name", "Resource Name"),
"service type": ("service_type", "Service type"),
"service origin": ("service_origin", "Service"),
"service_type": ("service_type", "Service type"),
"service_origin": ("service_origin", "Service"),
"unit": ("unit", "Unit of measurement"),
"default_quota": ("limit_with_unit", "Default Quota"),
"description": ("desc", "Description"),
"api_visible": ("api_visible",
......
......@@ -38,7 +38,8 @@ import logging
logger = logging.getLogger(__name__)
resource_fields = ['desc', 'unit', 'ui_visible', 'api_visible']
main_fields = ['desc', 'unit']
config_fields = ['ui_visible', 'api_visible']
class RegisterException(Exception):
......@@ -87,8 +88,12 @@ def add_resource(resource_dict):
service_type=service_type,
service_origin=service_origin)
exists = False
for field in config_fields:
value = resource_dict.get(field)
if value is not None:
setattr(r, field, value)
for field in resource_fields:
for field in main_fields:
value = resource_dict.get(field)
if value is not None:
setattr(r, field, value)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment