Revision 205cc8d3
b/snf-astakos-app/astakos/im/management/commands/reconcile-resources-astakos.py | ||
---|---|---|
41 | 41 |
from astakos.im.quotas import service_get_quotas, SYSTEM |
42 | 42 |
from astakos.im.functions import count_pending_app |
43 | 43 |
import astakos.quotaholder_app.callpoint as qh |
44 |
import astakos.quotaholder_app.exception as qh_exception |
|
44 | 45 |
|
45 | 46 |
|
46 | 47 |
class Command(BaseCommand): |
... | ... | |
129 | 130 |
pprint_table(self.stderr, unsynced, headers) |
130 | 131 |
if options["fix"]: |
131 | 132 |
provisions = map(create_provision, unsynced) |
132 |
s = qh.issue_commission('astakos', provisions, |
|
133 |
name='RECONCILE', force=force) |
|
133 |
try: |
|
134 |
s = qh.issue_commission('astakos', provisions, |
|
135 |
name='RECONCILE', force=force) |
|
136 |
except qh_exception.NoCapacityError: |
|
137 |
write("Reconciling failed because a limit has been " |
|
138 |
"reached. Use --force to ignore the check.\n") |
|
139 |
return |
|
140 |
|
|
134 | 141 |
qh.resolve_pending_commission('astakos', s) |
135 | 142 |
write("Fixed unsynced resources\n") |
136 | 143 |
|
b/snf-cyclades-app/synnefo/quotas/management/commands/reconcile-resources-cyclades.py | ||
---|---|---|
125 | 125 |
request["auto_accept"] = True |
126 | 126 |
request["name"] = "RECONCILE" |
127 | 127 |
request["provisions"] = map(create_provision, unsynced) |
128 |
qh.issue_commission(ASTAKOS_TOKEN, request) |
|
128 |
try: |
|
129 |
qh.issue_commission(ASTAKOS_TOKEN, request) |
|
130 |
except quotas.QuotaLimit: |
|
131 |
write("Reconciling failed because a limit has been " |
|
132 |
"reached. Use --force to ignore the check.\n") |
|
133 |
return |
|
129 | 134 |
write("Fixed unsynced resources\n") |
130 | 135 |
|
131 | 136 |
if pending_exists: |
b/snf-pithos-app/pithos/api/management/commands/reconcile-resources-pithos.py | ||
---|---|---|
38 | 38 |
from pithos.api.util import get_backend |
39 | 39 |
from pithos.backends.modular import CLUSTER_NORMAL, DEFAULT_SOURCE |
40 | 40 |
from synnefo.webproject.management import utils |
41 |
from astakosclient.errors import QuotaLimit |
|
41 | 42 |
|
42 | 43 |
backend = get_backend() |
43 | 44 |
|
... | ... | |
128 | 129 |
request['auto_accept'] = True |
129 | 130 |
request['name'] = "RECONCILE" |
130 | 131 |
request['provisions'] = map(create_provision, unsynced) |
131 |
backend.astakosclient.issue_commission( |
|
132 |
backend.service_token, request |
|
133 |
) |
|
132 |
try: |
|
133 |
backend.astakosclient.issue_commission( |
|
134 |
backend.service_token, request |
|
135 |
) |
|
136 |
except QuotaLimit: |
|
137 |
self.stdout.write( |
|
138 |
"Reconciling failed because a limit has been " |
|
139 |
"reached. Use --force to ignore the check.\n") |
|
140 |
return |
|
141 |
|
|
134 | 142 |
|
135 | 143 |
if pending_exists: |
136 | 144 |
self.stdout.write( |
Also available in: Unified diff