Provide backward compatibility for configuration.
This commit is contained in:
parent
2be88d0f34
commit
4ceaaa9fa2
4 changed files with 63 additions and 37 deletions
|
|
@ -65,7 +65,7 @@
|
||||||
other:
|
other:
|
||||||
- org.jgrapes.webconlet.oidclogin.LoginConlet
|
- org.jgrapes.webconlet.oidclogin.LoginConlet
|
||||||
"/ComponentCollector":
|
"/ComponentCollector":
|
||||||
"/VmViewer":
|
"/VmAccess":
|
||||||
displayResource:
|
displayResource:
|
||||||
preferredIpVersion: ipv4
|
preferredIpVersion: ipv4
|
||||||
syncPreviewsFor:
|
syncPreviewsFor:
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ patches:
|
||||||
other:
|
other:
|
||||||
- org.jgrapes.webconlet.locallogin.LoginConlet
|
- org.jgrapes.webconlet.locallogin.LoginConlet
|
||||||
"/ComponentCollector":
|
"/ComponentCollector":
|
||||||
"/VmViewer":
|
"/VmAccess":
|
||||||
displayResource:
|
displayResource:
|
||||||
preferredIpVersion: ipv4
|
preferredIpVersion: ipv4
|
||||||
syncPreviewsFor:
|
syncPreviewsFor:
|
||||||
|
|
|
||||||
|
|
@ -152,44 +152,57 @@ public class VmAccess extends FreeMarkerConlet<VmAccess.ViewerModel> {
|
||||||
@SuppressWarnings({ "unchecked", "PMD.AvoidDuplicateLiterals" })
|
@SuppressWarnings({ "unchecked", "PMD.AvoidDuplicateLiterals" })
|
||||||
@Handler
|
@Handler
|
||||||
public void onConfigurationUpdate(ConfigurationUpdate event) {
|
public void onConfigurationUpdate(ConfigurationUpdate event) {
|
||||||
event.structured(componentPath()).ifPresent(c -> {
|
event.structured(componentPath())
|
||||||
try {
|
.or(() -> {
|
||||||
var dispRes = (Map<String, Object>) c
|
var oldConfig = event.structured("/Manager/GuiHttpServer"
|
||||||
.getOrDefault("displayResource", Collections.emptyMap());
|
+ "/ConsoleWeblet/WebConsole/ComponentCollector/VmViewer");
|
||||||
switch ((String) dispRes.getOrDefault("preferredIpVersion",
|
if (oldConfig.isPresent()) {
|
||||||
"")) {
|
logger.warning(() -> "Using configuration with old "
|
||||||
case "ipv6":
|
+ "component name \"VmViewer\", please update to "
|
||||||
preferredIpVersion = Inet6Address.class;
|
+ "\"VmAccess\"");
|
||||||
break;
|
|
||||||
case "ipv4":
|
|
||||||
default:
|
|
||||||
preferredIpVersion = Inet4Address.class;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
return oldConfig;
|
||||||
|
})
|
||||||
|
.ifPresent(c -> {
|
||||||
|
try {
|
||||||
|
var dispRes = (Map<String, Object>) c
|
||||||
|
.getOrDefault("displayResource",
|
||||||
|
Collections.emptyMap());
|
||||||
|
switch ((String) dispRes.getOrDefault("preferredIpVersion",
|
||||||
|
"")) {
|
||||||
|
case "ipv6":
|
||||||
|
preferredIpVersion = Inet6Address.class;
|
||||||
|
break;
|
||||||
|
case "ipv4":
|
||||||
|
default:
|
||||||
|
preferredIpVersion = Inet4Address.class;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Delete connection file
|
// Delete connection file
|
||||||
deleteConnectionFile
|
deleteConnectionFile
|
||||||
= Optional.ofNullable(c.get("deleteConnectionFile"))
|
= Optional.ofNullable(c.get("deleteConnectionFile"))
|
||||||
.filter(v -> v instanceof String).map(v -> (String) v)
|
.filter(v -> v instanceof String)
|
||||||
.map(Boolean::parseBoolean).orElse(true);
|
.map(v -> (String) v)
|
||||||
|
.map(Boolean::parseBoolean).orElse(true);
|
||||||
|
|
||||||
// Users or roles for which previews should be synchronized
|
// Users or roles for which previews should be synchronized
|
||||||
syncUsers = ((List<Map<String, String>>) c.getOrDefault(
|
syncUsers = ((List<Map<String, String>>) c.getOrDefault(
|
||||||
"syncPreviewsFor", Collections.emptyList())).stream()
|
"syncPreviewsFor", Collections.emptyList())).stream()
|
||||||
.map(m -> m.get("user"))
|
.map(m -> m.get("user"))
|
||||||
.filter(s -> s != null).collect(Collectors.toSet());
|
.filter(s -> s != null).collect(Collectors.toSet());
|
||||||
logger.finest(() -> "Syncing previews for users: "
|
logger.finest(() -> "Syncing previews for users: "
|
||||||
+ syncUsers.toString());
|
+ syncUsers.toString());
|
||||||
syncRoles = ((List<Map<String, String>>) c.getOrDefault(
|
syncRoles = ((List<Map<String, String>>) c.getOrDefault(
|
||||||
"syncPreviewsFor", Collections.emptyList())).stream()
|
"syncPreviewsFor", Collections.emptyList())).stream()
|
||||||
.map(m -> m.get("role"))
|
.map(m -> m.get("role"))
|
||||||
.filter(s -> s != null).collect(Collectors.toSet());
|
.filter(s -> s != null).collect(Collectors.toSet());
|
||||||
logger.finest(() -> "Syncing previews for roles: "
|
logger.finest(() -> "Syncing previews for roles: "
|
||||||
+ syncRoles.toString());
|
+ syncRoles.toString());
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
logger.config("Malformed configuration: " + e.getMessage());
|
logger.config("Malformed configuration: " + e.getMessage());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean syncPreviews(Session session) {
|
private boolean syncPreviews(Session session) {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,19 @@ layout: vm-operator
|
||||||
|
|
||||||
# Upgrading
|
# Upgrading
|
||||||
|
|
||||||
|
## To version 4.0.0
|
||||||
|
|
||||||
|
The VmViewer conlet has been renamed to VmAccess. This affects the
|
||||||
|
[configuration](https://jdrupes.org/vm-operator/user-gui.html). Configuration information using the old path
|
||||||
|
"/Manager/GuiHttpServer/ConsoleWeblet/WebConsole/ComponentCollector/VmViewer"
|
||||||
|
is still accepted for backward compatibility, but should be updated.
|
||||||
|
|
||||||
|
The change of name also causes conlets added to the overview page by
|
||||||
|
users to "disappear" from the GUI. They have to be re-added.
|
||||||
|
|
||||||
|
The latter behavior also applies to the VmConlet conlet which has been
|
||||||
|
renamed to VmMgmt.
|
||||||
|
|
||||||
## To version 3.4.0
|
## To version 3.4.0
|
||||||
|
|
||||||
Starting with this version, the VM-Operator no longer uses a stateful set
|
Starting with this version, the VM-Operator no longer uses a stateful set
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue