Revision ee45eb81 snf-astakos-app/astakos/im/endpoints/qh.py

b/snf-astakos-app/astakos/im/endpoints/qh.py
53 53

  
54 54
inf = float('inf')
55 55

  
56
clientkey = 'astakos'
57

  
56 58
_client = None
57 59
def get_client():
58 60
    global _client
......
116 118
                                         'import_limit',
117 119
                                         'export_limit'))
118 120

  
119
@call('add_quota')
120
def add_quota(quotalimits_list):
121
def qh_add_quota(serial, quotalimits_list):
122
    if not QUOTAHOLDER_URL:
123
        return ()
124

  
125
    context = {}
126
    c = get_client()
127

  
121 128
    data = []
122 129
    append = data.append
123 130
    for ql in quotalimits_list:
124 131
        args = (ql.holder, ql.resource, ENTITY_KEY,
125 132
                0, ql.capacity, ql.import_limit, ql.export_limit)
126 133
        append(args)
127
    return data
128 134

  
135
    result = c.add_quota(context=context,
136
                         clientkey=clientkey,
137
                         serial=serial,
138
                         add_quota=data)
139

  
140
    return result
141

  
142
def qh_query_serials(serials):
143
    if not QUOTAHOLDER_URL:
144
        return ()
145

  
146
    context = {}
147
    c = get_client()
148
    result = c.query_serials(context=context,
149
                             clientkey=clientkey,
150
                             serials=serials)
151
    return result
152

  
153
def qh_ack_serials(serials):
154
    if not QUOTAHOLDER_URL:
155
        return ()
156

  
157
    context = {}
158
    c = get_client()
159
    result = c.ack_serials(context=context,
160
                           clientkey=clientkey,
161
                           serials=serials)
162
    return
129 163

  
130 164
@call('set_quota')
131 165
def send_resource_quantities(resources, client=None):

Also available in: Unified diff