show notification on migration if restart is not supported

This commit is contained in:
Sebastian Sdorra
2020-03-25 08:01:01 +01:00
parent fbc86e7d33
commit 68fc3b0643
2 changed files with 15 additions and 4 deletions

View File

@@ -143,14 +143,13 @@ class MigrationWizardServlet extends HttpServlet {
); );
Map<String, Object> model = Collections.singletonMap("contextPath", req.getContextPath()); Map<String, Object> model = Collections.singletonMap("contextPath", req.getContextPath());
respondWithTemplate(resp, model, "templates/repository-migration-restart.mustache");
ThreadContext.bind(new Subject.Builder(new DefaultSecurityManager()).authenticated(false).buildSubject()); ThreadContext.bind(new Subject.Builder(new DefaultSecurityManager()).authenticated(false).buildSubject());
if (restarter.isSupported()) { if (restarter.isSupported()) {
respondWithTemplate(resp, model, "templates/repository-migration-restart.mustache");
restarter.restart(MigrationWizardServlet.class, "wrote migration data"); restarter.restart(MigrationWizardServlet.class, "wrote migration data");
} else { } else {
respondWithTemplate(resp, model, "templates/repository-migration-manual-restart.mustache");
LOG.error("Restarting is not supported on this platform."); LOG.error("Restarting is not supported on this platform.");
LOG.error("Please do a manual restart"); LOG.error("Please do a manual restart");
} }

View File

@@ -0,0 +1,12 @@
{{<layout}}
{{$title}}SCM-Manager needs to be restarted{{/title}}
{{$content}}
<p class="notification is-warning">
The migration is prepared and gets executed after scm-manager is restarted. <br/>
Please restart your scm-manager instance.
</p>
{{/content}}
{{/layout}}