Skip to content

Commit

Permalink
api: servers: delete associated ports upon server removal
Browse files Browse the repository at this point in the history
  • Loading branch information
vilhelmprytz committed Nov 19, 2021
1 parent 7247705 commit 8d20053
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions wilfred/api/servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,16 @@ def remove(self, server: Server):

path = f"{self._configuration['data_path']}/{server.name}_{server.id}"

# delete all environment variables associated to this server
for x in (
session.query(EnvironmentVariable).filter_by(server_id=server.id).all()
):
session.delete(x)

# delete all additional ports associated to this server
for x in session.query(Port).filter_by(server_id=server.id).all():
session.delete(x)

session.delete(server)
session.commit()

Expand Down

0 comments on commit 8d20053

Please sign in to comment.