From cddb76e70b7127f5e0d0088bd59de99ebd1359e1 Mon Sep 17 00:00:00 2001
From: Violette Roche-Montane <violette.roche-montane@forgerock.com>
Date: Mon, 27 May 2013 13:07:05 +0000
Subject: [PATCH] OPENDJ-928 Update tool: add option to automatically accept the license
---
opends/src/server/org/opends/server/tools/upgrade/Upgrade.java | 42 ++++++++++++++++++++++++++----------------
1 files changed, 26 insertions(+), 16 deletions(-)
diff --git a/opends/src/server/org/opends/server/tools/upgrade/Upgrade.java b/opends/src/server/org/opends/server/tools/upgrade/Upgrade.java
index dd67572..f4a5d5e 100644
--- a/opends/src/server/org/opends/server/tools/upgrade/Upgrade.java
+++ b/opends/src/server/org/opends/server/tools/upgrade/Upgrade.java
@@ -396,7 +396,7 @@
if (context.checkCLIUserOption(handler, IGNORE_ERRORS_MODE)
== ConfirmationCallback.YES)
{
- context = new UpgradeContext(fromVersion, toVersion, true);
+ context.setIgnoreErrorsMode(true);
}
/*
@@ -580,7 +580,7 @@
throw new ClientException(EXIT_CODE_SUCCESS, message);
}
- // TODO The upgrade only supports version >= 2.4.5.
+ // The upgrade only supports version >= 2.4.5.
if (context.getFromVersion().compareTo(UPGRADESUPPORTSVERSIONFROM) < 0)
{
throw new ClientException(EXIT_CODE_ERROR,
@@ -647,29 +647,39 @@
// and force to accept it.
context.notify(handler, INFO_LICENSE_DETAILS_CLI_LABEL.get());
- final int answer = context.confirmYN(handler,
- INFO_LICENSE_ACCEPT.get(), ConfirmationCallback.NO);
+ if (context.checkCLIUserOption(handler, ACCEPT_LICENSE_MODE)
+ == ConfirmationCallback.NO)
+ {
- if (answer == ConfirmationCallback.NO)
- {
- System.exit(EXIT_CODE_SUCCESS);
- }
- else if (answer == ConfirmationCallback.YES)
- {
- // Creates the file
- LicenseFile.setApproval(true);
- LicenseFile.createFileLicenseApproved();
+ final int answer =
+ context.confirmYN(handler, INFO_LICENSE_ACCEPT.get(),
+ ConfirmationCallback.NO);
+
+ if (answer == ConfirmationCallback.NO)
+ {
+ System.exit(EXIT_CODE_SUCCESS);
+ }
+ else if (answer == ConfirmationCallback.YES)
+ {
+ createLicenseApproval();
+ }
}
else
{
- context.notify(handler,
- INFO_LICENSE_CLI_ACCEPT_INVALID_RESPONSE.get());
+ context.notify(handler, INFO_LICENSE_ACCEPT.get());
+ context.notify(handler, INFO_PROMPT_YES_COMPLETE_ANSWER.get());
+ createLicenseApproval();
}
}
}
}
-
+ private static void createLicenseApproval()
+ {
+ // Creates the file
+ LicenseFile.setApproval(true);
+ LicenseFile.createFileLicenseApproved();
+ }
// Prevent instantiation.
private Upgrade()
--
Gitblit v1.10.0