Revision e407f159 snf-cyclades-app/synnefo/quotas/__init__.py
b/snf-cyclades-app/synnefo/quotas/__init__.py | ||
---|---|---|
35 | 35 |
FloatingIP) |
36 | 36 |
|
37 | 37 |
from synnefo.settings import (CYCLADES_SERVICE_TOKEN as ASTAKOS_TOKEN, |
38 |
ASTAKOS_BASE_URL)
|
|
38 |
ASTAKOS_AUTH_URL)
|
|
39 | 39 |
from astakosclient import AstakosClient |
40 | 40 |
from astakosclient.errors import AstakosClientException, QuotaLimit |
41 | 41 |
from functools import wraps |
... | ... | |
43 | 43 |
import logging |
44 | 44 |
log = logging.getLogger(__name__) |
45 | 45 |
|
46 |
|
|
46 | 47 |
DEFAULT_SOURCE = 'system' |
47 | 48 |
RESOURCES = [ |
48 | 49 |
"cyclades.vm", |
... | ... | |
63 | 64 |
def get(cls): |
64 | 65 |
if cls._object is None: |
65 | 66 |
cls._object = AstakosClient( |
66 |
ASTAKOS_BASE_URL, |
|
67 |
ASTAKOS_TOKEN, |
|
68 |
ASTAKOS_AUTH_URL, |
|
67 | 69 |
use_pool=True, |
68 | 70 |
retry=3, |
69 | 71 |
logger=log) |
... | ... | |
94 | 96 |
|
95 | 97 |
qh = Quotaholder.get() |
96 | 98 |
try: |
97 |
serial = qh.issue_one_commission(ASTAKOS_TOKEN,
|
|
98 |
user, source, provisions, name=name,
|
|
99 |
force=force, auto_accept=auto_accept)
|
|
99 |
serial = qh.issue_one_commission( |
|
100 |
user, source, provisions, name=name, |
|
101 |
force=force, auto_accept=auto_accept) |
|
100 | 102 |
except QuotaLimit as e: |
101 | 103 |
msg, details = render_overlimit_exception(e) |
102 | 104 |
raise faults.OverLimit(msg, details=details) |
... | ... | |
143 | 145 |
reject = [] |
144 | 146 |
|
145 | 147 |
qh = Quotaholder.get() |
146 |
response = qh.resolve_commissions(ASTAKOS_TOKEN, accept, reject)
|
|
148 |
response = qh.resolve_commissions(accept, reject) |
|
147 | 149 |
|
148 | 150 |
if strict: |
149 | 151 |
failed = response["failed"] |
... | ... | |
188 | 190 |
|
189 | 191 |
def get_quotaholder_pending(): |
190 | 192 |
qh = Quotaholder.get() |
191 |
pending_serials = qh.get_pending_commissions(ASTAKOS_TOKEN)
|
|
193 |
pending_serials = qh.get_pending_commissions() |
|
192 | 194 |
return pending_serials |
193 | 195 |
|
194 | 196 |
|
Also available in: Unified diff