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

@@ -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<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());
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");
}