From 68fc3b064329f8769d01e5678e57a68a51387663 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 25 Mar 2020 08:01:01 +0100 Subject: [PATCH] show notification on migration if restart is not supported --- .../sonia/scm/update/MigrationWizardServlet.java | 7 +++---- .../repository-migration-manual-restart.mustache | 12 ++++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 scm-webapp/src/main/resources/templates/repository-migration-manual-restart.mustache diff --git a/scm-webapp/src/main/java/sonia/scm/update/MigrationWizardServlet.java b/scm-webapp/src/main/java/sonia/scm/update/MigrationWizardServlet.java index 415a05fe2b..99833c57cc 100644 --- a/scm-webapp/src/main/java/sonia/scm/update/MigrationWizardServlet.java +++ b/scm-webapp/src/main/java/sonia/scm/update/MigrationWizardServlet.java @@ -21,7 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ - + package sonia.scm.update; import com.github.mustachejava.DefaultMustacheFactory; @@ -143,14 +143,13 @@ class MigrationWizardServlet extends HttpServlet { ); Map model = Collections.singletonMap("contextPath", req.getContextPath()); - - respondWithTemplate(resp, model, "templates/repository-migration-restart.mustache"); - ThreadContext.bind(new Subject.Builder(new DefaultSecurityManager()).authenticated(false).buildSubject()); if (restarter.isSupported()) { + respondWithTemplate(resp, model, "templates/repository-migration-restart.mustache"); restarter.restart(MigrationWizardServlet.class, "wrote migration data"); } else { + respondWithTemplate(resp, model, "templates/repository-migration-manual-restart.mustache"); LOG.error("Restarting is not supported on this platform."); LOG.error("Please do a manual restart"); } diff --git a/scm-webapp/src/main/resources/templates/repository-migration-manual-restart.mustache b/scm-webapp/src/main/resources/templates/repository-migration-manual-restart.mustache new file mode 100644 index 0000000000..a0d2fd1a96 --- /dev/null +++ b/scm-webapp/src/main/resources/templates/repository-migration-manual-restart.mustache @@ -0,0 +1,12 @@ +{{ + The migration is prepared and gets executed after scm-manager is restarted.
+ Please restart your scm-manager instance. +

+ {{/content}} + +{{/layout}}