Revision 5aac5dc4 snf-astakos-app/astakos/im/models.py

b/snf-astakos-app/astakos/im/models.py
72 72
    PROJECT_MEMBER_JOIN_POLICIES, PROJECT_MEMBER_LEAVE_POLICIES)
73 73
from astakos.im import settings as astakos_settings
74 74
from astakos.im.endpoints.qh import (
75
    register_users, register_quotas, qh_check_users, qh_get_quota_limits,
75
    register_users, send_quotas, qh_check_users, qh_get_quota_limits,
76 76
    register_services, register_resources, qh_add_quota, QuotaLimits,
77 77
    qh_query_serials, qh_ack_serials,
78 78
    QuotaValues, add_quota_values)
......
2211 2211
                     retries=retries,
2212 2212
                     retry_wait=retry_wait)
2213 2213

  
2214

  
2215
def all_users_quotas(users):
2216
    quotas = {}
2217
    for user in users:
2218
        quotas[user.uuid] = user.all_quotas()
2219
    return quotas
2220

  
2214 2221
def _sync_users(users, sync):
2215 2222
    sync_finish_serials()
2216 2223

  
2217 2224
    existing, nonexisting = qh_check_users(users)
2218 2225
    resources = get_resource_names()
2219
    quotas = qh_get_quota_limits(existing, resources)
2226
    registered_quotas = qh_get_quota_limits(existing, resources)
2227
    astakos_quotas = all_users_quotas(users)
2220 2228

  
2221 2229
    if sync:
2222 2230
        r = register_users(nonexisting)
2223
        r = register_quotas(users)
2231
        r = send_quotas(astakos_quotas)
2224 2232

  
2225
    # TODO: some proper reporting
2226
    return (existing, nonexisting, quotas)
2233
    return (existing, nonexisting, registered_quotas, astakos_quotas)
2227 2234

  
2228 2235
def sync_users(users, sync=True, retries=3, retry_wait=1.0):
2229 2236
    return lock_sync(_sync_users,

Also available in: Unified diff