Commit 0b999462 authored by Lukas Burgey's avatar Lukas Burgey
Browse files

Implement client deregistration

parent 5c996046
......@@ -134,6 +134,13 @@ class Service(models.Model):
def __str__(self):
def remove_service(self):
for deployment in Deployment.objects.filter(
def handle_vo_deployments(self):
for vo in self.vos.all():
......@@ -273,6 +280,10 @@ class Deployment(models.Model):
if self.state_target == 'deployed':
def service_removed(self, service):
LOGGER.debug(self.msg('Removing service {}'.format(service)))
LOGGER.debug('TODO implement service removal')
def publish_to_client(self):
# avoiding circular dependencies here
from .serializers.clients import DeploymentSerializer
......@@ -6,4 +6,5 @@ URLPATTERNS = [
url(r'^deployments', clients.DeploymentsView.as_view()),
url(r'^config', clients.ConfigurationView.as_view()),
url(r'^response', clients.ResponseView.as_view()),
url(r'^deregister', clients.DeregisterView.as_view()),
......@@ -164,6 +164,30 @@ class ConfigurationView(views.APIView):
return Response(response)
class DeregisterView(views.APIView):
authentication_classes = AUTHENTICATION_CLASSES
def put(self, request):
# the site where client is located
client_site = None
client_site =
except models.Site.DoesNotExist:
raise ImproperlyConfigured('client has no site')
# deregister the client / its services / its site
# we expect all deployments at the clients to be removed (and therefore simply delete them all)'[DEREG] Client %s from site %s is deregistering', request.user, client_site)
for service in'[DEREG] Triggering service removal %s', service)
response = 'Success deregistering'
return Response(response)
def response_view_error(err):
return Response(
data={'error': err},
Supports Markdown
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