AMBARI-21347. Service Page: Some Alerts are missing their Status (magyari_sandor)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9833bc18 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9833bc18 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9833bc18 Branch: refs/heads/branch-feature-logsearch-ui Commit: 9833bc182d9b44a69bb766de77311d4a3a50fa5e Parents: 08dd492 Author: Sandor Magyari <smagy...@hortonworks.com> Authored: Mon Jun 26 20:01:59 2017 +0200 Committer: Sandor Magyari <smagy...@hortonworks.com> Committed: Tue Jun 27 11:15:03 2017 +0200 ---------------------------------------------------------------------- .../controller/AmbariManagementControllerImpl.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/9833bc18/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java index ed707e7..6781f65 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java @@ -182,6 +182,7 @@ import org.apache.ambari.server.state.StackInfo; import org.apache.ambari.server.state.State; import org.apache.ambari.server.state.UnlimitedKeyJCERequirement; import org.apache.ambari.server.state.configgroup.ConfigGroupFactory; +import org.apache.ambari.server.state.fsm.InvalidStateTransitionException; import org.apache.ambari.server.state.quicklinksprofile.QuickLinkVisibilityController; import org.apache.ambari.server.state.quicklinksprofile.QuickLinkVisibilityControllerFactory; import org.apache.ambari.server.state.quicklinksprofile.QuickLinksProfile; @@ -193,6 +194,7 @@ import org.apache.ambari.server.state.stack.WidgetLayout; import org.apache.ambari.server.state.stack.WidgetLayoutInfo; import org.apache.ambari.server.state.svccomphost.ServiceComponentHostInstallEvent; import org.apache.ambari.server.state.svccomphost.ServiceComponentHostOpInProgressEvent; +import org.apache.ambari.server.state.svccomphost.ServiceComponentHostOpSucceededEvent; import org.apache.ambari.server.state.svccomphost.ServiceComponentHostStartEvent; import org.apache.ambari.server.state.svccomphost.ServiceComponentHostStopEvent; import org.apache.ambari.server.state.svccomphost.ServiceComponentHostUpgradeEvent; @@ -3023,7 +3025,15 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle // START task should run configuration script. if (newState == State.INSTALLED && skipInstallTaskForComponent(requestProperties, cluster, scHost)) { LOG.info("Skipping create of INSTALL task for {} on {}.", scHost.getServiceComponentName(), scHost.getHostName()); - scHost.setState(State.INSTALLED); + // set state to INSTALLING, then immediately send an ServiceComponentHostOpSucceededEvent to allow + // transitioning from INSTALLING --> INSTALLED. + scHost.setState(State.INSTALLING); + long now = System.currentTimeMillis(); + try { + scHost.handleEvent(new ServiceComponentHostOpSucceededEvent(scHost.getServiceComponentName(), scHost.getHostName(), now)); + } catch (InvalidStateTransitionException e) { + LOG.error("Error transitioning ServiceComponentHost state to INSTALLED", e); + } } else { // !!! can never be null RepositoryVersionEntity repoVersion = serviceComponent.getDesiredRepositoryVersion();