Revision f72ba65d snf-astakos-app/astakos/im/register.py

b/snf-astakos-app/astakos/im/register.py
104 104
    return r, exists
105 105

  
106 106

  
107
def update_resource(resource, uplimit):
108
    old_uplimit = resource.uplimit
109
    if uplimit == old_uplimit:
110
        logger.info("Resource %s has limit %s; no need to update."
111
                    % (resource.name, uplimit))
112
        return []
113
    else:
114
        resource.uplimit = uplimit
115
        resource.save()
116
        logger.info("Updated resource %s with limit %s."
117
                    % (resource.name, uplimit))
118
        affected = quotas.qh_change_resource_limit(resource)
119
        return affected
107
def update_resources(updates):
108
    resources = []
109
    for resource, uplimit in updates:
110
        resources.append(resource)
111
        old_uplimit = resource.uplimit
112
        if uplimit == old_uplimit:
113
            logger.info("Resource %s has limit %s; no need to update."
114
                        % (resource.name, uplimit))
115
        else:
116
            resource.uplimit = uplimit
117
            resource.save()
118
            logger.info("Updated resource %s with limit %s."
119
                        % (resource.name, uplimit))
120 120

  
121 121

  
122 122
def get_resources(resources=None, services=None):

Also available in: Unified diff