Commit 70000efc authored by Georgios D. Tsoukalas's avatar Georgios D. Tsoukalas

add token to quotaholder client

also rename QUOTA_HOLDER to QUOTAHOLDER in settings strings
parent 55e9bed8
......@@ -91,8 +91,10 @@ ASTAKOS_HELPDESK_NOTIFICATION_EMAIL_SUBJECT '%s alpha2 testing account activated
ASTAKOS_EMAIL_CHANGE_EMAIL_SUBJECT 'Email change on %s alpha2 testing' % SITENAME Email change subject
ASTAKOS_PASSWORD_RESET_EMAIL_SUBJECT 'Password reset on %s alpha2 testing' % SITENAME Password change email subject
ASTAKOS_QUOTA_HOLDER_URL '' The quota holder URI
ASTAKOS_QUOTAHOLDER_URL '' The quotaholder URI
e.g. ``http://localhost:8080/api/quotaholder/v``
ASTAKOS_QUOTAHOLDER_TOKEN '' The secret token for accessing the quotaholder URI
ASTAKOS_SERVICES {'cyclades': {'resources': [{'desc': 'Number of virtual machines', Default cloud service information
'group': 'compute',
'name': 'vm',
......
......@@ -38,9 +38,10 @@ from functools import wraps
from django.utils.translation import ugettext as _
from astakos.im.settings import QUOTA_HOLDER_URL, LOGGING_LEVEL
from astakos.im.settings import (
QUOTAHOLDER_URL, QUOTAHOLDER_TOKEN, LOGGING_LEVEL)
if QUOTA_HOLDER_URL:
if QUOTAHOLDER_URL:
from kamaki.clients.quotaholder import QuotaholderClient
ENTITY_KEY = '1'
......@@ -59,10 +60,10 @@ def call(func_name):
if not entities:
return client, ()
if not QUOTA_HOLDER_URL:
if not QUOTAHOLDER_URL:
return client, ()
c = client or QuotaholderClient(QUOTA_HOLDER_URL)
c = client or QuotaholderClient(QUOTAHOLDER_URL, token=QUOTAHOLDER_TOKEN)
func = c.__dict__.get(func_name)
if not func:
return c, ()
......@@ -285,7 +286,7 @@ def timeline_charge(entity, resource, after, before, details, charge_type):
m = 'charge type %s not supported' % charge_type
raise ValueError(m)
quotaholder = QuotaholderClient(QUOTA_HOLDER_URL)
quotaholder = QuotaholderClient(QUOTAHOLDER_URL, token=QUOTAHOLDER_TOKEN)
timeline = quotaholder.get_timeline(
context={},
after=after,
......
......@@ -129,7 +129,8 @@ PASSWORD_RESET_EMAIL_SUBJECT = getattr(
'Password reset on %s alpha2 testing' % SITENAME)
# Set the quota holder component URI
QUOTA_HOLDER_URL = getattr(settings, 'ASTAKOS_QUOTA_HOLDER_URL', '')
QUOTAHOLDER_URL = getattr(settings, 'ASTAKOS_QUOTAHOLDER_URL', '')
QUOTAHOLDER_TOKEN = getattr(settings, 'ASTAKOS_QUOTAHOLDER_Token', '')
# Set the cloud service properties
SERVICES = getattr(settings, 'ASTAKOS_SERVICES', {
......
......@@ -113,8 +113,9 @@
#ASTAKOS_EMAIL_CHANGE_EMAIL_SUBJECT = 'Email change on %s alpha2 testing' % SITENAME
#ASTAKOS_PASSWORD_RESET_EMAIL_SUBJECT = 'Password reset on %s alpha2 testing' % SITENAME
# Set the quota holder component URI
#ASTAKOS_QUOTA_HOLDER_URL = ''
# Set the quotaholder component URI and token
#ASTAKOS_QUOTAHOLDER_URL = ''
#ASTAKOS_QUOTAHOLDER_TOKEN = ''
# Set the cloud service properties
# SERVICES = getattr(settings, 'ASTAKOS_SERVICES',
......
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