[java-identity-provider] 03/03: IDP-1499 do not back fresh installs

Rod Widdowson rdw at steadingsoftware.com
Fri Dec 20 04:25:34 EST 2019


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch master
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=3c0209cc390fe5cf897d1d8b42b6a35ee606c135

commit 3c0209cc390fe5cf897d1d8b42b6a35ee606c135
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Fri Dec 20 09:24:54 2019 +0000

    IDP-1499 do not back fresh installs
    
    https://issues.shibboleth.net/jira/browse/IDP-1499
---
 .../net/shibboleth/idp/installer/CopyDistribution.java   | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/CopyDistribution.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/CopyDistribution.java
index ee391e9..8174630 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/CopyDistribution.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/CopyDistribution.java
@@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory;
 
 import net.shibboleth.utilities.java.support.component.AbstractInitializableComponent;
 import net.shibboleth.utilities.java.support.component.ComponentSupport;
+import net.shibboleth.utilities.java.support.logic.Constraint;
 
 /**
  * Copy the distribution to the final location.  Prior to doing so
@@ -46,14 +47,18 @@ public final class CopyDistribution extends AbstractInitializableComponent {
     /** Properties for the job. */
     @Nonnull private final InstallerProperties installerProps;
 
+    /** The state of the current install. */
+    @Nonnull private final CurrentInstallState installState;
+
     /** Constructor.
      * @param props The environment for the work.
-     * @param installState  Where we are right now.
+     * @param state  Where we are right now.
      */
-    public CopyDistribution(@Nonnull final InstallerProperties props, @Nonnull final CurrentInstallState installState) {
+    public CopyDistribution(@Nonnull final InstallerProperties props, @Nonnull final CurrentInstallState state) {
         ComponentSupport.ifNotInitializedThrowUninitializedComponentException(props);
-        ComponentSupport.ifNotInitializedThrowUninitializedComponentException(installState);
-        installerProps = props;
+        ComponentSupport.ifNotInitializedThrowUninitializedComponentException(state);
+        installerProps = Constraint.isNotNull(props, "Installer Properties should be non null");
+        installState = Constraint.isNotNull(state, "Current state should be non-null");
     }
 
     /** Copy the distribution from the dstribution to their new locations, having
@@ -72,6 +77,9 @@ public final class CopyDistribution extends AbstractInitializableComponent {
      * @throws BuildException if badness occurs
      */
     protected void backupOld() throws BuildException {
+        if (installState.getInstalledVersion() == null) {
+            return;
+        }
         final SimpleDateFormat fmt = new SimpleDateFormat("'old-'yyyy-MM-dd-HH-mm-ss");
         final Path backup = installerProps.getTargetDir().resolve(fmt.format(Date.from(Instant.now())));
         InstallerSupport.createDirectory(backup);

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


More information about the commits mailing list