Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
feudal
feudalBackend
Commits
3163780f
Commit
3163780f
authored
Dec 08, 2020
by
lukas.burgey
Browse files
--wip--
parent
c1649a00
Pipeline
#121895
failed with stage
in 1 minute and 22 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
feudal/backend/views/clients.py
View file @
3163780f
...
...
@@ -170,29 +170,36 @@ class ConfigurationView(views.APIView):
})
class
DeregisterView
(
views
.
APIView
):
class
DeregisterView
(
generics
.
List
APIView
):
authentication_classes
=
AUTHENTICATION_CLASSES
permission_classes
=
PERMISSION_CLASSES
serializer_class
=
clients
.
DeploymentStateSerializer
def
put
(
self
,
request
):
def
get_queryset
(
self
):
# the site where client is located
client_site
=
None
try
:
client_site
=
request
.
user
.
site
client_site
=
self
.
request
.
user
.
site
except
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)
LOGGER
.
info
(
'[DEREG] Client %s from site %s is deregistering'
,
request
.
user
,
client_site
)
LOGGER
.
info
(
'[DEREG] Client %s from site %s is deregistering'
,
self
.
request
.
user
,
client_site
)
for
service
in
client_site
.
services
.
all
():
LOGGER
.
info
(
'[DEREG] Triggering service removal %s'
,
service
)
service
.
remove_service
()
response
=
'Success deregistering'
return
Response
(
response
)
# the service removals usually cause a lot of deployments to be orphaned
# we return these to the client, so it can remove them
return
[
state
for
state
in
self
.
request
.
user
.
site
.
states
.
all
()
if
state
.
is_pending_for_restarting_client
]
URLPATTERNS
=
[
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment