So auto login according to pool setting.

This commit is contained in:
Michael Lipp 2025-03-03 21:26:10 +01:00
parent 701194799f
commit dfe3038463
5 changed files with 36 additions and 34 deletions

View file

@ -105,7 +105,7 @@ public class PoolMonitor extends
// When pool is deleted, save VMs in pending
if (type == ResponseType.DELETED) {
Optional.ofNullable(pools.get(poolName)).ifPresent(pool -> {
pool.setDefined(false);
pool.setUndefined();
if (pool.vms().isEmpty()) {
pools.remove(poolName);
}
@ -129,11 +129,8 @@ public class PoolMonitor extends
// Get pool and merge changes
var vmPool = pools.computeIfAbsent(poolName, k -> new VmPool(poolName));
var newData = client().getJSON().getGson().fromJson(
GsonPtr.to(poolModel.data()).to("spec").get(), VmPool.class);
vmPool.setRetention(newData.retention());
vmPool.setPermissions(newData.permissions());
vmPool.setDefined(true);
vmPool.defineFrom(client().getJSON().getGson().fromJson(
GsonPtr.to(poolModel.data()).to("spec").get(), VmPool.class));
poolPipeline.fire(new VmPoolChanged(vmPool));
}

View file

@ -301,6 +301,10 @@ public class VmMonitor extends
// Make sure that a newly assigned VM is running.
chosenVm.pipeline().fire(new ModifyVm(vmDef.name(),
"state", "Running", chosenVm));
if (vmPool.loginOnAssignment()) {
chosenVm.pipeline().fire(new ModifyVm(vmDef.name(),
"display/loggedInUser", event.toUser(), chosenVm));
}
return;
}
}