GUACAMOLE-2030: Show the Keeper notation warning only once.
This commit is contained in:
1 parent
1b73d49c7d
commit
ffa8b2c336
2 files changed
+15
-12
No files matched your search
+5
-2
@@ -656,14 +656,17 @@ public class KsmClient {
|
||||
// There is no way to differentiate if an error is caused by
|
||||
// a non-existing record or a pure parse failure.
|
||||
catch (Error | Exception e) {
|
||||
logger.warn("Keeper notation \"{}\" could not be resolved "
|
||||
+ "to a record: {}", notation, e.getMessage());
|
||||
logger.debug("Retrieval of record by Keeper notation failed.", e);
|
||||
|
||||
// If the secret is not found, invoke the fallback function
|
||||
if (fallbackFunction != null)
|
||||
return fallbackFunction.get();
|
||||
|
||||
// Show the warning only if there is no fallback function
|
||||
// and this was the last attempt
|
||||
logger.warn("Keeper notation \"{}\" could not be resolved "
|
||||
+ "to a record: {}", notation, e.getMessage());
|
||||
|
||||
return CompletableFuture.completedFuture(null);
|
||||
}
|
||||
finally {
|
||||
|
||||
+10
-10
@@ -152,21 +152,21 @@ public class KsmSecretService implements VaultSecretService {
|
||||
// Attempt to find a KSM config for this connection or group
|
||||
String ksmConfig = getConnectionGroupKsmConfig(userContext, connectable);
|
||||
|
||||
return getClient(ksmConfig).getSecret(name, new GuacamoleExceptionSupplier<Future<String>>() {
|
||||
|
||||
@Override
|
||||
public Future<String> get() throws GuacamoleException {
|
||||
|
||||
// Get the user-supplied KSM config, if allowed by config and
|
||||
// set by the user
|
||||
String userKsmConfig = getUserKSMConfig(userContext, connectable);
|
||||
|
||||
// If the user config happens to be the same as admin-defined one,
|
||||
// don't bother trying again
|
||||
if (userKsmConfig != null && !Objects.equal(userKsmConfig, ksmConfig))
|
||||
return getClient(userKsmConfig).getSecret(name);
|
||||
// If the user config is not defined or happens to be the same
|
||||
// as admin-defined one, resolve without the fallback
|
||||
if (userKsmConfig == null || Objects.equal(userKsmConfig, ksmConfig)) {
|
||||
return getClient(ksmConfig).getSecret(name);
|
||||
}
|
||||
|
||||
return CompletableFuture.completedFuture(null);
|
||||
return getClient(ksmConfig).getSecret(name, new GuacamoleExceptionSupplier<Future<String>>() {
|
||||
|
||||
@Override
|
||||
public Future<String> get() throws GuacamoleException {
|
||||
return getClient(userKsmConfig).getSecret(name);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user