Skip to content

Commit

Permalink
MGR-148
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Müller authored and Matthias Müller committed Mar 30, 2023
1 parent 2fe0fa1 commit d79418e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
Expand Up @@ -80,8 +80,9 @@ public void perform(Site site, Application application, Environment environment,
okMessage = MessageConstants.SITE_DELETED;
} else if (ACTION_RELOAD.equals(action)) {
errorMessage = MessageConstants.SITE_RELOADED_ERROR;
service.reloadSite(request, application, siteId, fp);
okMessage = MessageConstants.SITE_RELOADED;
if (service.reloadSite(request, application, siteId, fp)) {
okMessage = MessageConstants.SITE_RELOADED;
}
} else if (ACTION_RELOAD_TEMPLATE.equals(action)) {
service.reloadTemplate(environment, options.getString(SITE, "sitename"));
okMessage = MessageConstants.SITE_TEMPLATE_RELOADED;
Expand Down
Expand Up @@ -1589,7 +1589,7 @@ public void deleteProperty(Request request, String id, FieldProcessor fp) throws
}
}

public void reloadSite(Request request, Application application, Integer siteId, FieldProcessor fp)
public boolean reloadSite(Request request, Application application, Integer siteId, FieldProcessor fp)
throws BusinessException {
try {
InitializerService initializerService = getInitializerService(application);
Expand All @@ -1599,17 +1599,25 @@ public void reloadSite(Request request, Application application, Integer siteId,
if (site.isActive()) {
try {
initializerService.loadSite(request.getEnvironment(), site, fp);
logger.info("Site reloaded: " + siteName);
Site siteByName = RequestUtil.getSiteByName(request.getEnvironment(), siteName);
if (null == siteByName || !SiteState.STARTED.equals(siteByName.getState())) {
logger.info("Site not started: {}", siteName);
} else {
logger.info("Site reloaded: {}", siteName);
return true;
}
} catch (InvalidConfigurationException e) {
throw new BusinessException("Invalid configuration for site: " + siteName, e);
}
} else {
shutdownSite(request.getEnvironment(), siteName);
fp.addOkMessage(request.getMessage(MessageConstants.SITE_STOPPED, siteName));
}
}
} catch (Exception e) {
request.handleException(fp, e);
}
return false;
}

private InitializerService getInitializerService(Application application) {
Expand Down
Expand Up @@ -172,7 +172,7 @@ void deleteSite(Request request, String host, Integer siteId, FieldProcessor fp,

void deleteProperty(Request request, String id, FieldProcessor fp) throws BusinessException;

void reloadSite(Request request, Application application, Integer siteId, FieldProcessor fp)
boolean reloadSite(Request request, Application application, Integer siteId, FieldProcessor fp)
throws BusinessException;

String startSite(Request request, Application application, Integer siteId, FieldProcessor fp)
Expand Down

0 comments on commit d79418e

Please sign in to comment.