[java-identity-provider] 01/02: IDP-2162 Add a "test" option for the plugin installer
Rod Widdowson
rdw at steadingsoftware.com
Thu Aug 24 10:13:20 UTC 2023
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch main
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=659174c5b2d6ae1f02ddf76ce5d8c2c888735907
commit 659174c5b2d6ae1f02ddf76ce5d8c2c888735907
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Thu Aug 24 11:11:01 2023 +0100
IDP-2162 Add a "test" option for the plugin installer
https://shibboleth.atlassian.net/browse/IDP-2162
Return a failure if an update, install or remove left a module
requirement outstanding. Do the same on list if the mopdule state
is wrong.
---
.../idp/installer/plugin/impl/PluginInstallerCLI.java | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerCLI.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerCLI.java
index ae56b55ee..cf6d37e4a 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerCLI.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerCLI.java
@@ -126,7 +126,7 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
args.setHttpClientName("shibboleth.InternalHttpClient");
}
- final int ret = super.doRun(args);
+ int ret = super.doRun(args);
if (ret != RC_OK) {
return ret;
}
@@ -159,7 +159,7 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
if (args.isListAvailable()) {
return doListAvailable();
}
- doList(args.isFullList(), args.getPluginId());
+ ret = doList(args.isFullList(), args.getPluginId());
break;
case INSTALLDIR:
@@ -222,7 +222,7 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
try (final PluginInstaller inst = new PluginInstaller(
Constraint.isNotNull(getHttpClient(), "HJttpClient cannot be non null (by construction"))) {
constructPluginInstaller(inst, args);
- doList(false, null);
+ ret = doList(false, null);
} catch (ComponentInitializationException e) {
getLogger().error("Post Install list failed:", e);
return RC_IO;
@@ -346,11 +346,13 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
/** List all installed plugins (or just one if provided).
* @param fullList whether to do full deatils
* @param pluginId the pluginId or null.
+ * @return {@link AbstractCommandLine#RC_IO} if we hit a module issue, otherwise {@link AbstractCommandLine#RC_OK}
*/
- private void doList(final boolean fullList, @Nullable final String pluginId) {
+ private int doList(final boolean fullList, @Nullable final String pluginId) {
boolean list = false;
final PluginInstaller inst = installer;
assert inst != null;
+ int result = RC_OK;
final List<IdPPlugin> plugins = inst.getInstalledPlugins();
final Set<String> modules = inst.getLoadedModules();
for (final IdPPlugin plugin: plugins) {
@@ -360,9 +362,10 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
plugin.getPluginId(),
plugin.getMajorVersion(),plugin.getMinorVersion(), plugin.getPatchVersion()));
for (final String module:plugin.getRequiredModules()) {
- if (!modules.contains(module)) {
- getLogger().error("Plugin {} requires non-enabled module {}", plugin.getPluginId(), module);
- }
+ if (!modules.contains(module)) {
+ getLogger().error("Plugin {} requires non-enabled module {}", plugin.getPluginId(), module);
+ result = RC_IO;
+ }
}
if (fullList) {
printDetails(plugin);
@@ -376,6 +379,7 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
outOrLog("Plugin " + pluginId + " not installed");
}
}
+ return result;
}
/** List the contents for the detailed plugin.
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list