Commit 7af3e5f6 by Bach Dániel

vm: remove vm api

parent 11610612
...@@ -21,7 +21,6 @@ urlpatterns = patterns( ...@@ -21,7 +21,6 @@ urlpatterns = patterns(
url(r'^network/', include('network.urls')), url(r'^network/', include('network.urls')),
url(r'^dashboard/', include('dashboard.urls')), url(r'^dashboard/', include('dashboard.urls')),
url(r'^accounts/', include('django.contrib.auth.urls')), url(r'^accounts/', include('django.contrib.auth.urls')),
url(r'^vm-api/', include('vm.urls')),
) )
......
from django.conf.urls import patterns, url
from .views import BootUrl
urlpatterns = patterns(
'',
url(r'^b/(?P<token>.*)/$', BootUrl.as_view()),
)
from django.views.generic.base import View
from django.http import HttpResponse
from django.core import signing
from django.shortcuts import get_object_or_404
from vm.models import Instance
from datetime import datetime
class BootUrl(View):
def get(self, request, token):
try:
id = signing.loads(token, salt='activate')
except:
return HttpResponse("Invalid token.")
inst = get_object_or_404(Instance, id=id)
if inst.active_since:
return HttpResponse("Already booted?")
else:
inst.active_since = datetime.now()
inst.save()
return HttpResponse("KTHXBYE")
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 sign in to comment