Commit 165eb1d7 by Őry Máté

vm: send absolute url token to agent

parent 4b6c37cb
...@@ -20,6 +20,7 @@ from __future__ import unicode_literals, absolute_import ...@@ -20,6 +20,7 @@ from __future__ import unicode_literals, absolute_import
from collections import OrderedDict from collections import OrderedDict
from itertools import chain from itertools import chain
from os import getenv from os import getenv
from urlparse import urljoin
import json import json
import logging import logging
import re import re
...@@ -3120,3 +3121,7 @@ class UserKeyCreate(LoginRequiredMixin, SuccessMessageMixin, CreateView): ...@@ -3120,3 +3121,7 @@ class UserKeyCreate(LoginRequiredMixin, SuccessMessageMixin, CreateView):
kwargs = super(UserKeyCreate, self).get_form_kwargs() kwargs = super(UserKeyCreate, self).get_form_kwargs()
kwargs['user'] = self.request.user kwargs['user'] = self.request.user
return kwargs return kwargs
def absolute_url(url):
return urljoin(settings.DJANGO_URL, url)
...@@ -673,7 +673,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin, ...@@ -673,7 +673,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
readable_name=ugettext_noop( readable_name=ugettext_noop(
"notify owner about expiration"), "notify owner about expiration"),
on_commit=on_commit): on_commit=on_commit):
from dashboard.views import VmRenewView from dashboard.views import VmRenewView, absolute_url
level = self.get_level_object("owner") level = self.get_level_object("owner")
for u, ulevel in self.get_users_with_level(level__pk=level.pk): for u, ulevel in self.get_users_with_level(level__pk=level.pk):
try: try:
...@@ -688,7 +688,8 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin, ...@@ -688,7 +688,8 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
else: else:
success.append(u) success.append(u)
if self.status == "RUNNING": if self.status == "RUNNING":
token = VmRenewView.get_token_url(self, self.owner) token = absolute_url(
VmRenewView.get_token_url(self, self.owner))
queue = self.get_remote_queue_name("agent") queue = self.get_remote_queue_name("agent")
agent_tasks.send_expiration.apply_async( agent_tasks.send_expiration.apply_async(
queue=queue, args=(self.vm_name, token)) queue=queue, args=(self.vm_name, token))
......
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