Revision a9e5e76a snf-cyclades-app/synnefo/vmapi/views.py

b/snf-cyclades-app/synnefo/vmapi/views.py
31 31
# interpreted as representing official policies, either expressed
32 32
# or implied, of GRNET S.A.
33 33

  
34
from logging import getLogger
35

  
34 36
from django.http import Http404, HttpResponse
35 37

  
36 38
from synnefo.vmapi import backend, get_key
37
from synnefo.vmapi.settings import RESET_PARAMS
39
from synnefo.vmapi import settings
40

  
41
log = getLogger('synnefo.vmapi')
38 42

  
39 43
def server_params(request, uuid):
40
    uuid = request.GET.get('uuid', None)
41 44
    if not uuid:
42 45
        raise Http404
43 46

  
44
    params = backend.get(get_key(uuid))
47
    cache_key = get_key(uuid)
48
    params = backend.get(cache_key)
45 49
    if not params:
50
        log.error('Request vmapi params key not found: %s', cache_key)
46 51
        raise Http404
47 52

  
48
    if RESET_PARAMS:
49
        backend.set(uuid, None)
53
    if settings.RESET_PARAMS:
54
        backend.set(cache_key, None)
50 55

  
51 56
    return HttpResponse(params, content_type="application/json")
52 57

  

Also available in: Unified diff