Commit 56893aa2 authored by Christos Stavrakakis's avatar Christos Stavrakakis

Import quotaholder settings only if needed

parent 4c350cbd
......@@ -30,16 +30,19 @@
from functools import wraps
from contextlib import contextmanager
from synnefo.settings import (CYCLADES_USE_QUOTAHOLDER,
CYCLADES_QUOTAHOLDER_URL,
CYCLADES_QUOTAHOLDER_TOKEN,
VMS_USER_QUOTA, MAX_VMS_PER_USER,
NETWORKS_USER_QUOTA, MAX_NETWORKS_PER_USER)
from synnefo.db.models import QuotaHolderSerial, VirtualMachine, Network
from synnefo.api.faults import OverLimit
from synnefo.settings import CYCLADES_USE_QUOTAHOLDER
if CYCLADES_USE_QUOTAHOLDER:
from synnefo.settings import (CYCLADES_QUOTAHOLDER_URL,
CYCLADES_QUOTAHOLDER_TOKEN)
from kamaki.clients.quotaholder import QuotaholderClient
else:
from synnefo.settings import (VMS_USER_QUOTA, MAX_VMS_PER_USER,
NETWORKS_USER_QUOTA, MAX_NETWORKS_PER_USER)
from kamaki.clients.quotaholder import QuotaholderClient
from synnefo.lib.quotaholder.api import (NoCapacityError, NoQuantityError)
from synnefo.lib.commissioning import CallError
......@@ -189,6 +192,7 @@ def issue_commission(**commission_info):
except CallError as e:
if e.call_error in ["NoCapacityError", "NoQuantityError"]:
raise OverLimit("Limit exceeded for your account")
raise
if serial:
return QuotaHolderSerial.objects.create(serial=serial)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment