Skip to content

Commit 8f05a9d

Browse files
committed
fix: droplet registration
1 parent e6c9f03 commit 8f05a9d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

controller-runtime/src/main/kotlin/app/simplecloud/controller/runtime/droplet/ControllerDropletService.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,12 @@ class ControllerDropletService(private val dropletRepository: DropletRepository)
2929
}
3030

3131
override suspend fun registerDroplet(request: RegisterDropletRequest): RegisterDropletResponse {
32-
dropletRepository.find(request.definition.type, request.definition.id)
33-
?: throw StatusException(Status.NOT_FOUND.withDescription("This Droplet does not exist"))
3432
val droplet = Droplet.fromDefinition(request.definition)
35-
3633
try {
34+
dropletRepository.delete(droplet)
3735
dropletRepository.save(droplet)
3836
} catch (e: Exception) {
39-
throw StatusException(Status.INTERNAL.withDescription("Error whilst updating Droplet").withCause(e))
37+
throw StatusException(Status.INTERNAL.withDescription("Error whilst registering Droplet").withCause(e))
4038
}
4139
return registerDropletResponse { this.definition = droplet.toDefinition() }
4240
}

0 commit comments

Comments
 (0)