[java-identity-provider] 01/02: IDP-1595 Plugin Handling improvements

Rod Widdowson rdw at steadingsoftware.com
Wed Sep 30 16:09:31 UTC 2020


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=3bdfb7696ccd381db30b1a5c471a3d83df77d5f9

commit 3bdfb7696ccd381db30b1a5c471a3d83df77d5f9
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Wed Sep 30 15:57:26 2020 +0100

    IDP-1595 Plugin Handling improvements
    
    https://issues.shibboleth.net/jira/browse/IDP-1595
    
    --noPrompt for unattanded installs
---
 .../installer/plugin/impl/PluginInstallerArguments.java | 17 +++++++++++++++--
 .../idp/installer/plugin/impl/PluginInstallerCLI.java   | 14 +++++++++-----
 2 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerArguments.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerArguments.java
index 42aab9db7..a8744a631 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerArguments.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerArguments.java
@@ -47,6 +47,10 @@ public class PluginInstallerArguments extends AbstractIdPHomeAwareCommandLineArg
     @Parameter(names= {"-p", "--pluginId"})
     @Nullable private String pluginId;
 
+    /** Suppress Prompts. */
+    @Parameter(names= {"--noPrompt"})
+    @Nullable private boolean noPrompt;
+
     /** Brief info about installed plugins. */
     @Parameter(names= {"-l", "--list"})
     @Nullable private boolean list;
@@ -150,17 +154,25 @@ public class PluginInstallerArguments extends AbstractIdPHomeAwareCommandLineArg
     /** Are we doing a full List?
      * @return {@link #fullList}
      */
-    public boolean getFullList() {
+    public boolean isFullList() {
         return fullList;
     }
 
     /** Are we doing a List?
      * @return {@link #list}
      */
-    public boolean getList() {
+    public boolean isList() {
         return list;
     }
 
+    /** Are we doing an unattended install?
+     * @return {@link #list}
+     */
+    public boolean isUnattended() {
+        return noPrompt;
+    }
+
+
     /** Return the version to update to or null.
      * @return the version or null
      */
@@ -283,6 +295,7 @@ public class PluginInstallerArguments extends AbstractIdPHomeAwareCommandLineArg
         out.println(String.format("  %-22s %s", "-r, --remove-jars <PluginId>",
                 "remove any installed jars (and other resources) from the war file. \n" + 
                 "\t\t\tDOES NOT UNDO any other installation"));
+        out.println(String.format("  %-22s %s", "--noPrompt", "Unattended Install"));
         out.println();
     }
 
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 4d4e16223..7c4f8d634 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
@@ -110,11 +110,11 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
         }
 
         try (final PluginInstaller inst = new PluginInstaller()){
-            constructPluginInstaller(inst);
+            constructPluginInstaller(inst, args);
 
             switch (args.getOperation()) {
                 case LIST:
-                    doList(args.getFullList(), args.getPluginId());
+                    doList(args.isFullList(), args.getPluginId());
                     break;
 
                 case INSTALLDIR:
@@ -158,12 +158,16 @@ public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<Pl
 
     /** Build the installer.
      * @param inst the newly created installed
+     * @param args the arguments
      * @throws ComponentInitializationException as required
      */
-    private void constructPluginInstaller(final PluginInstaller inst) throws ComponentInitializationException {
+    private void constructPluginInstaller(final PluginInstaller inst,
+            final PluginInstallerArguments args) throws ComponentInitializationException {
         inst.setIdpHome(Path.of(getApplicationContext().getEnvironment().getProperty("idp.home")));
-        inst.setAcceptCert(new InstallerQuery("Accept this Certificate"));
-        inst.setAcceptDownload(new InstallerQuery("Download from"));
+        if (!args.isUnattended()) {
+            inst.setAcceptCert(new InstallerQuery("Accept this Certificate"));
+            inst.setAcceptDownload(new InstallerQuery("Download from"));
+        }
         if (getHttpClient()!= null) {
             inst.setHttpClient(getHttpClient());
         }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list