mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

kenneth_suter
17.54.2007 d7d04e6626869b086f61e39e5c05346a765baf7c
This commit addresses a few miscellaneous issues with upgrader:

- The server health check at the end was being done starting with connection handlers disabled which would fail to catch some problems.

- The registration of the log publishers for DirectoryServer.startServer was being done at the wrong time and so starting server in process never picked up log messages that may indicate a problem.

- The .zip file was being extracted a second time unnecessarily for the CLI version of the tool.
4 files modified
78 ■■■■ changed files
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java 39 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/InProcessServerController.java 29 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ServerHealthChecker.java 6 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties
@@ -817,10 +817,10 @@
summary-upgrade-history=Recording Upgrade History...
summary-upgrade-cleanup=Cleaning Up...
summary-upgrade-abort=Canceling Upgrade...
summary-upgrade-finished-successfully=<b>OpenDS QuickSetup Completed \
summary-upgrade-finished-successfully=<b>OpenDS QuickUpgrade Completed \
  Successfully.</b><br>The OpenDS installation at {0} has now been upgraded \
  to version {1}.
summary-upgrade-finished-successfully-cli=OpenDS QuickSetup Completed \
summary-upgrade-finished-successfully-cli=OpenDS QuickUpgrade Completed \
  Successfully.  The OpenDS installation at {0} has now been upgraded \
  to version {1}.
summary-upgrade-finished-with-errors=<b>OpenDS QuickUpgrade Failed</b><br>\
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
@@ -712,8 +712,8 @@
    try {
      ZipExtractor extractor = null;
      if (Utils.isWebStart()) {
        ZipExtractor extractor = null;
        try {
          LOG.log(Level.INFO, "Waiting for Java Web Start jar download");
          waitForLoader(15); // TODO: ratio
@@ -722,29 +722,27 @@
          InputStream in =
                  Upgrader.class.getClassLoader().getResourceAsStream(zipName);
          extractor = new ZipExtractor(in, zipName);
        } catch (ApplicationException e) {
          LOG.log(Level.SEVERE, "Error downloading Web Start jars", e);
          throw e;
        }
      } else {
        File buildZip = getUpgradeUserData().getInstallPackage();
        LOG.log(Level.INFO, "Existing local build file " + buildZip.getName());
        extractor = new ZipExtractor(buildZip);
      }
      checkAbort();
        checkAbort();
      try {
        setCurrentProgressStep(UpgradeProgressStep.EXTRACTING);
        extractor.extract(getStageDirectory());
        notifyListeners(formatter.getFormattedDone() +
                formatter.getLineBreak());
        LOG.log(Level.INFO, "extraction finished");
      } catch (ApplicationException e) {
        notifyListeners(formatter.getFormattedError() +
                formatter.getLineBreak());
        LOG.log(Level.INFO, "Error extracting build file", e);
        throw e;
        try {
          setCurrentProgressStep(UpgradeProgressStep.EXTRACTING);
          extractor.extract(getStageDirectory());
          notifyListeners(formatter.getFormattedDone() +
                  formatter.getLineBreak());
          LOG.log(Level.INFO, "extraction finished");
        } catch (ApplicationException e) {
          notifyListeners(formatter.getFormattedError() +
                  formatter.getLineBreak());
          LOG.log(Level.INFO, "Error extracting build file", e);
          throw e;
        }
      }
      checkAbort();
@@ -1193,8 +1191,9 @@
        // Restart the server after putting the files
        // back like we found them.
        getServerController().stopServer(true);
        getServerController().startServer(true);
        ServerController sc = new ServerController(getInstallation());
        sc.stopServer(true);
        sc.startServer(true);
      } catch (IOException e) {
        LOG.log(Level.INFO, "Error getting backup directory", e);
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/InProcessServerController.java
@@ -137,7 +137,7 @@
            (disableConnectionHandlers ? "disabled" : "enabled"));
    System.setProperty(
            "org.opends.server.DisableConnectionHandlers",
            disableConnectionHandlers ? "true" : null);
            disableConnectionHandlers ? "true" : "false");
    return startServer();
  }
@@ -179,6 +179,19 @@
    try {
      org.opends.server.core.DirectoryServer directoryServer =
              org.opends.server.core.DirectoryServer.getInstance();
      // Bootstrap and start the Directory Server.
      LOG.log(Level.FINER, "Bootstrapping directory server");
      directoryServer.bootstrapServer();
      LOG.log(Level.FINER, "Initializing configuration");
      String configClass = "org.opends.server.extensions.ConfigFileHandler";
      String configPath = Utils.getPath(
              installation.getCurrentConfigurationFile());
      directoryServer.initializeConfiguration(configClass, configPath);
      try {
        DebugLogPublisher startupDebugPublisher =
@@ -206,6 +219,7 @@
                        });
        ErrorLogger.addErrorLogPublisher(DN.NULL_DN,
                startupErrorPublisher);
        AccessLogPublisher startupAccessPublisher =
                TextAccessLogPublisher.getStartupTextAccessPublisher(
                        new ServerControllerTextWriter(output) {
@@ -224,19 +238,6 @@
                e.toString());
      }
      org.opends.server.core.DirectoryServer directoryServer =
              org.opends.server.core.DirectoryServer.getInstance();
      // Bootstrap and start the Directory Server.
      LOG.log(Level.FINER, "Bootstrapping directory server");
      directoryServer.bootstrapServer();
      LOG.log(Level.FINER, "Initializing configuration");
      String configClass = "org.opends.server.extensions.ConfigFileHandler";
      String configPath = Utils.getPath(
              installation.getCurrentConfigurationFile());
      directoryServer.initializeConfiguration(configClass, configPath);
      LOG.log(Level.FINER, "Invoking start server");
      directoryServer.startServer();
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ServerHealthChecker.java
@@ -78,16 +78,14 @@
      if (installation.getStatus().isServerRunning()) {
        new ServerController(installation).stopServer(true);
      }
      OperationOutput op = control.startServer(true);
      OperationOutput op = control.startServer(false);
      errors = op.getErrorMessages(UNHEALTHY_SERVER_LOG_REGEX);
    } catch (Exception e) {
      if (e instanceof ApplicationException) {
        throw (ApplicationException)e;
      } else {
        throw new ApplicationException(ApplicationException.Type.APPLICATION,
                "Server health check failed.  Please resolve the following " +
                        "before running the upgrade " +
                        "tool: " + e.getLocalizedMessage(), e);
                "Server health check failed: " + e.getLocalizedMessage(), e);
      }
    } finally {
      if (control != null) {