mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-21 08:03:13 +09:00
Allow deleting unassigned instances
Handle delete instance requests for instances that are not assigned to a slave.
This commit is contained in:
1 parent
541d2ad337
commit
3343d53d75
1 file changed
+12
@@ -411,6 +411,18 @@ class ControlConnection extends BaseConnection {
|
|||||||
db.instances.set(instanceId, instanceConfig);
|
db.instances.set(instanceId, instanceConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async deleteInstanceRequestHandler(message, request) {
|
||||||
|
let instanceConfig = db.instances.get(message.data.instance_id);
|
||||||
|
if (!instanceConfig) {
|
||||||
|
throw new errors.RequestError(`Instance with ID ${message.data.instance_id} does not exist`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (instanceConfig.get('instance.assigned_slave') !== null) {
|
||||||
|
await this.forwardRequestToInstance(message, request);
|
||||||
|
}
|
||||||
|
db.instances.delete(message.data.instance_id);
|
||||||
|
}
|
||||||
|
|
||||||
async getInstanceConfigRequestHandler(message) {
|
async getInstanceConfigRequestHandler(message) {
|
||||||
let instanceConfig = db.instances.get(message.data.instance_id);
|
let instanceConfig = db.instances.get(message.data.instance_id);
|
||||||
if (!instanceConfig) {
|
if (!instanceConfig) {
|
||||||
|
|||||||
Reference in new issue
Block a user