@Test(expected = AmbariException.class) public void testNoCandidateHostThrowsException() throws Exception { long clusterId = clusters.getCluster("c1").getClusterId(); clusters.getHost("c6402").setMaintenanceState(clusterId, MaintenanceState.ON); injector.getInstance(ActionMetadata.class).addServiceCheckAction("ZOOKEEPER"); Map<String, String> requestProperties = new HashMap<String, String>() { { put("context", "Service Check ZooKeeper"); put("operation_level/level", "SERVICE"); put("operation_level/service_name", "ZOOKEEPER"); put("operation_level/cluster_name", "c1"); } }; ExecuteActionRequest actionRequest = new ExecuteActionRequest("c1", "ZOOKEEPER_QUORUM_SERVICE_CHECK", null, Collections.singletonList(new RequestResourceFilter("ZOOKEEPER", "ZOOKEEPER_CLIENT", Collections.singletonList("c6402"))), new RequestOperationLevel(Resource.Type.Service, "c1", "ZOOKEEPER", null, null), new HashMap<String, String>(), false); EasyMock.replay(hostRoleCommand, actionManager, configHelper); ambariManagementController.createAction(actionRequest, requestProperties); Assert.fail( "Expected an exception since there are no hosts which can run the ZK service check"); }
public void addServiceCheckAction(Stage stage, String hostname, String smokeTestRole, long nowTimestamp, String serviceName, String componentName, Map<String, String> actionParameters, boolean retryAllowed, boolean autoSkipFailure) throws AmbariException { String clusterName = stage.getClusterName(); Cluster cluster = clusters.getCluster(clusterName); StackId stackId = cluster.getDesiredStackVersion(); AmbariMetaInfo ambariMetaInfo = managementController.getAmbariMetaInfo(); ServiceInfo serviceInfo = ambariMetaInfo.getService(stackId.getStackName(), stackId.getStackVersion(), serviceName); StackInfo stackInfo = ambariMetaInfo.getStack(stackId.getStackName(), stackId.getStackVersion()); stage.addHostRoleExecutionCommand(hostname, Role.valueOf(smokeTestRole), RoleCommand.SERVICE_CHECK, new ServiceComponentHostOpInProgressEvent(componentName, hostname, nowTimestamp), cluster.getClusterName(), serviceName, retryAllowed, autoSkipFailure); HostRoleCommand hrc = stage.getHostRoleCommand(hostname, smokeTestRole); if (hrc != null) { hrc.setCommandDetail(String.format("%s %s", RoleCommand.SERVICE_CHECK.toString(), serviceName)); } Map<String, Map<String, String>> configurations = new TreeMap<>(); Map<String, Map<String, Map<String, String>>> configurationAttributes = new TreeMap<>(); Map<String, Map<String, String>> configTags = new TreeMap<>(); ExecutionCommand execCmd = stage.getExecutionCommandWrapper(hostname, smokeTestRole).getExecutionCommand(); if(actionParameters != null && actionParameters.containsKey(KeyNames.REFRESH_CONFIG_TAGS_BEFORE_EXECUTION)){ execCmd.setForceRefreshConfigTagsBeforeExecution(true); } if (!execCmd.getForceRefreshConfigTagsBeforeExecution()) { configTags = managementController.findConfigurationTagsWithOverrides(cluster, hostname); } execCmd.setConfigurations(configurations); execCmd.setConfigurationAttributes(configurationAttributes); execCmd.setConfigurationTags(configTags); execCmd.setClusterHostInfo( StageUtils.getClusterHostInfo(cluster)); for (ServiceComponentHost sch : cluster.getServiceComponentHosts(hostname)) { execCmd.getLocalComponents().add(sch.getServiceComponentName()); } Map<String, String> commandParams = new TreeMap<>(); Map<String, ServiceInfo> serviceInfos = ambariMetaInfo.getServices(stackId.getStackName(), stackId.getStackVersion()); for (ServiceInfo serviceInfoInstance : serviceInfos.values()) { if (serviceInfoInstance.getServiceType() != null) { LOG.debug("Adding {} to command parameters for {}", serviceInfoInstance.getServiceType(), serviceInfoInstance.getName()); commandParams.put("dfs_type", serviceInfoInstance.getServiceType()); break; } } String commandTimeout = configs.getDefaultAgentTaskTimeout(false); if (serviceInfo.getSchemaVersion().equals(AmbariMetaInfo.SCHEMA_VERSION_2)) { CommandScriptDefinition script = serviceInfo.getCommandScript(); if (script != null) { commandParams.put(SCRIPT, script.getScript()); commandParams.put(SCRIPT_TYPE, script.getScriptType().toString()); if (script.getTimeout() > 0) { commandTimeout = String.valueOf(script.getTimeout()); } } else { String message = String.format("Service %s has no command script " + "defined. It is not possible to run service check" + " for this service", serviceName); throw new AmbariException(message); } } Long overriddenTimeout = configs.getAgentServiceCheckTaskTimeout(); if (!overriddenTimeout.equals(Configuration.AGENT_SERVICE_CHECK_TASK_TIMEOUT.getDefaultValue())) { commandTimeout = String.valueOf(overriddenTimeout); } commandParams.put(COMMAND_TIMEOUT, commandTimeout); String checkType = configHelper.getValueFromDesiredConfigurations(cluster, ConfigHelper.CLUSTER_ENV, ConfigHelper.SERVICE_CHECK_TYPE); if (ConfigHelper.SERVICE_CHECK_MINIMAL.equals(checkType)) { int actualTimeout = Integer.parseInt(commandParams.get(COMMAND_TIMEOUT)) / 2; actualTimeout = actualTimeout < MIN_STRICT_SERVICE_CHECK_TIMEOUT ? MIN_STRICT_SERVICE_CHECK_TIMEOUT : actualTimeout; commandParams.put(COMMAND_TIMEOUT, Integer.toString(actualTimeout)); } commandParams.put(SERVICE_PACKAGE_FOLDER, serviceInfo.getServicePackageFolder()); commandParams.put(HOOKS_FOLDER, stackInfo.getStackHooksFolder()); execCmd.setCommandParams(commandParams); if (actionParameters != null) { execCmd.setRoleParams(actionParameters); } }
AmbariCustomCommandExecutionHelper { public void addServiceCheckAction(Stage stage, String hostname, String smokeTestRole, long nowTimestamp, String serviceName, String componentName, Map<String, String> actionParameters, boolean retryAllowed, boolean autoSkipFailure) throws AmbariException { String clusterName = stage.getClusterName(); Cluster cluster = clusters.getCluster(clusterName); StackId stackId = cluster.getDesiredStackVersion(); AmbariMetaInfo ambariMetaInfo = managementController.getAmbariMetaInfo(); ServiceInfo serviceInfo = ambariMetaInfo.getService(stackId.getStackName(), stackId.getStackVersion(), serviceName); StackInfo stackInfo = ambariMetaInfo.getStack(stackId.getStackName(), stackId.getStackVersion()); stage.addHostRoleExecutionCommand(hostname, Role.valueOf(smokeTestRole), RoleCommand.SERVICE_CHECK, new ServiceComponentHostOpInProgressEvent(componentName, hostname, nowTimestamp), cluster.getClusterName(), serviceName, retryAllowed, autoSkipFailure); HostRoleCommand hrc = stage.getHostRoleCommand(hostname, smokeTestRole); if (hrc != null) { hrc.setCommandDetail(String.format("%s %s", RoleCommand.SERVICE_CHECK.toString(), serviceName)); } Map<String, Map<String, String>> configurations = new TreeMap<>(); Map<String, Map<String, Map<String, String>>> configurationAttributes = new TreeMap<>(); Map<String, Map<String, String>> configTags = new TreeMap<>(); ExecutionCommand execCmd = stage.getExecutionCommandWrapper(hostname, smokeTestRole).getExecutionCommand(); if(actionParameters != null && actionParameters.containsKey(KeyNames.REFRESH_CONFIG_TAGS_BEFORE_EXECUTION)){ execCmd.setForceRefreshConfigTagsBeforeExecution(true); } if (!execCmd.getForceRefreshConfigTagsBeforeExecution()) { configTags = managementController.findConfigurationTagsWithOverrides(cluster, hostname); } execCmd.setConfigurations(configurations); execCmd.setConfigurationAttributes(configurationAttributes); execCmd.setConfigurationTags(configTags); execCmd.setClusterHostInfo( StageUtils.getClusterHostInfo(cluster)); for (ServiceComponentHost sch : cluster.getServiceComponentHosts(hostname)) { execCmd.getLocalComponents().add(sch.getServiceComponentName()); } Map<String, String> commandParams = new TreeMap<>(); Map<String, ServiceInfo> serviceInfos = ambariMetaInfo.getServices(stackId.getStackName(), stackId.getStackVersion()); for (ServiceInfo serviceInfoInstance : serviceInfos.values()) { if (serviceInfoInstance.getServiceType() != null) { LOG.debug("Adding {} to command parameters for {}", serviceInfoInstance.getServiceType(), serviceInfoInstance.getName()); commandParams.put("dfs_type", serviceInfoInstance.getServiceType()); break; } } String commandTimeout = configs.getDefaultAgentTaskTimeout(false); if (serviceInfo.getSchemaVersion().equals(AmbariMetaInfo.SCHEMA_VERSION_2)) { CommandScriptDefinition script = serviceInfo.getCommandScript(); if (script != null) { commandParams.put(SCRIPT, script.getScript()); commandParams.put(SCRIPT_TYPE, script.getScriptType().toString()); if (script.getTimeout() > 0) { commandTimeout = String.valueOf(script.getTimeout()); } } else { String message = String.format("Service %s has no command script " + "defined. It is not possible to run service check" + " for this service", serviceName); throw new AmbariException(message); } } Long overriddenTimeout = configs.getAgentServiceCheckTaskTimeout(); if (!overriddenTimeout.equals(Configuration.AGENT_SERVICE_CHECK_TASK_TIMEOUT.getDefaultValue())) { commandTimeout = String.valueOf(overriddenTimeout); } commandParams.put(COMMAND_TIMEOUT, commandTimeout); String checkType = configHelper.getValueFromDesiredConfigurations(cluster, ConfigHelper.CLUSTER_ENV, ConfigHelper.SERVICE_CHECK_TYPE); if (ConfigHelper.SERVICE_CHECK_MINIMAL.equals(checkType)) { int actualTimeout = Integer.parseInt(commandParams.get(COMMAND_TIMEOUT)) / 2; actualTimeout = actualTimeout < MIN_STRICT_SERVICE_CHECK_TIMEOUT ? MIN_STRICT_SERVICE_CHECK_TIMEOUT : actualTimeout; commandParams.put(COMMAND_TIMEOUT, Integer.toString(actualTimeout)); } commandParams.put(SERVICE_PACKAGE_FOLDER, serviceInfo.getServicePackageFolder()); commandParams.put(HOOKS_FOLDER, stackInfo.getStackHooksFolder()); execCmd.setCommandParams(commandParams); if (actionParameters != null) { execCmd.setRoleParams(actionParameters); } } }
AmbariCustomCommandExecutionHelper { public void addServiceCheckAction(Stage stage, String hostname, String smokeTestRole, long nowTimestamp, String serviceName, String componentName, Map<String, String> actionParameters, boolean retryAllowed, boolean autoSkipFailure) throws AmbariException { String clusterName = stage.getClusterName(); Cluster cluster = clusters.getCluster(clusterName); StackId stackId = cluster.getDesiredStackVersion(); AmbariMetaInfo ambariMetaInfo = managementController.getAmbariMetaInfo(); ServiceInfo serviceInfo = ambariMetaInfo.getService(stackId.getStackName(), stackId.getStackVersion(), serviceName); StackInfo stackInfo = ambariMetaInfo.getStack(stackId.getStackName(), stackId.getStackVersion()); stage.addHostRoleExecutionCommand(hostname, Role.valueOf(smokeTestRole), RoleCommand.SERVICE_CHECK, new ServiceComponentHostOpInProgressEvent(componentName, hostname, nowTimestamp), cluster.getClusterName(), serviceName, retryAllowed, autoSkipFailure); HostRoleCommand hrc = stage.getHostRoleCommand(hostname, smokeTestRole); if (hrc != null) { hrc.setCommandDetail(String.format("%s %s", RoleCommand.SERVICE_CHECK.toString(), serviceName)); } Map<String, Map<String, String>> configurations = new TreeMap<>(); Map<String, Map<String, Map<String, String>>> configurationAttributes = new TreeMap<>(); Map<String, Map<String, String>> configTags = new TreeMap<>(); ExecutionCommand execCmd = stage.getExecutionCommandWrapper(hostname, smokeTestRole).getExecutionCommand(); if(actionParameters != null && actionParameters.containsKey(KeyNames.REFRESH_CONFIG_TAGS_BEFORE_EXECUTION)){ execCmd.setForceRefreshConfigTagsBeforeExecution(true); } if (!execCmd.getForceRefreshConfigTagsBeforeExecution()) { configTags = managementController.findConfigurationTagsWithOverrides(cluster, hostname); } execCmd.setConfigurations(configurations); execCmd.setConfigurationAttributes(configurationAttributes); execCmd.setConfigurationTags(configTags); execCmd.setClusterHostInfo( StageUtils.getClusterHostInfo(cluster)); for (ServiceComponentHost sch : cluster.getServiceComponentHosts(hostname)) { execCmd.getLocalComponents().add(sch.getServiceComponentName()); } Map<String, String> commandParams = new TreeMap<>(); Map<String, ServiceInfo> serviceInfos = ambariMetaInfo.getServices(stackId.getStackName(), stackId.getStackVersion()); for (ServiceInfo serviceInfoInstance : serviceInfos.values()) { if (serviceInfoInstance.getServiceType() != null) { LOG.debug("Adding {} to command parameters for {}", serviceInfoInstance.getServiceType(), serviceInfoInstance.getName()); commandParams.put("dfs_type", serviceInfoInstance.getServiceType()); break; } } String commandTimeout = configs.getDefaultAgentTaskTimeout(false); if (serviceInfo.getSchemaVersion().equals(AmbariMetaInfo.SCHEMA_VERSION_2)) { CommandScriptDefinition script = serviceInfo.getCommandScript(); if (script != null) { commandParams.put(SCRIPT, script.getScript()); commandParams.put(SCRIPT_TYPE, script.getScriptType().toString()); if (script.getTimeout() > 0) { commandTimeout = String.valueOf(script.getTimeout()); } } else { String message = String.format("Service %s has no command script " + "defined. It is not possible to run service check" + " for this service", serviceName); throw new AmbariException(message); } } Long overriddenTimeout = configs.getAgentServiceCheckTaskTimeout(); if (!overriddenTimeout.equals(Configuration.AGENT_SERVICE_CHECK_TASK_TIMEOUT.getDefaultValue())) { commandTimeout = String.valueOf(overriddenTimeout); } commandParams.put(COMMAND_TIMEOUT, commandTimeout); String checkType = configHelper.getValueFromDesiredConfigurations(cluster, ConfigHelper.CLUSTER_ENV, ConfigHelper.SERVICE_CHECK_TYPE); if (ConfigHelper.SERVICE_CHECK_MINIMAL.equals(checkType)) { int actualTimeout = Integer.parseInt(commandParams.get(COMMAND_TIMEOUT)) / 2; actualTimeout = actualTimeout < MIN_STRICT_SERVICE_CHECK_TIMEOUT ? MIN_STRICT_SERVICE_CHECK_TIMEOUT : actualTimeout; commandParams.put(COMMAND_TIMEOUT, Integer.toString(actualTimeout)); } commandParams.put(SERVICE_PACKAGE_FOLDER, serviceInfo.getServicePackageFolder()); commandParams.put(HOOKS_FOLDER, stackInfo.getStackHooksFolder()); execCmd.setCommandParams(commandParams); if (actionParameters != null) { execCmd.setRoleParams(actionParameters); } }  }
AmbariCustomCommandExecutionHelper { public void addServiceCheckAction(Stage stage, String hostname, String smokeTestRole, long nowTimestamp, String serviceName, String componentName, Map<String, String> actionParameters, boolean retryAllowed, boolean autoSkipFailure) throws AmbariException { String clusterName = stage.getClusterName(); Cluster cluster = clusters.getCluster(clusterName); StackId stackId = cluster.getDesiredStackVersion(); AmbariMetaInfo ambariMetaInfo = managementController.getAmbariMetaInfo(); ServiceInfo serviceInfo = ambariMetaInfo.getService(stackId.getStackName(), stackId.getStackVersion(), serviceName); StackInfo stackInfo = ambariMetaInfo.getStack(stackId.getStackName(), stackId.getStackVersion()); stage.addHostRoleExecutionCommand(hostname, Role.valueOf(smokeTestRole), RoleCommand.SERVICE_CHECK, new ServiceComponentHostOpInProgressEvent(componentName, hostname, nowTimestamp), cluster.getClusterName(), serviceName, retryAllowed, autoSkipFailure); HostRoleCommand hrc = stage.getHostRoleCommand(hostname, smokeTestRole); if (hrc != null) { hrc.setCommandDetail(String.format("%s %s", RoleCommand.SERVICE_CHECK.toString(), serviceName)); } Map<String, Map<String, String>> configurations = new TreeMap<>(); Map<String, Map<String, Map<String, String>>> configurationAttributes = new TreeMap<>(); Map<String, Map<String, String>> configTags = new TreeMap<>(); ExecutionCommand execCmd = stage.getExecutionCommandWrapper(hostname, smokeTestRole).getExecutionCommand(); if(actionParameters != null && actionParameters.containsKey(KeyNames.REFRESH_CONFIG_TAGS_BEFORE_EXECUTION)){ execCmd.setForceRefreshConfigTagsBeforeExecution(true); } if (!execCmd.getForceRefreshConfigTagsBeforeExecution()) { configTags = managementController.findConfigurationTagsWithOverrides(cluster, hostname); } execCmd.setConfigurations(configurations); execCmd.setConfigurationAttributes(configurationAttributes); execCmd.setConfigurationTags(configTags); execCmd.setClusterHostInfo( StageUtils.getClusterHostInfo(cluster)); for (ServiceComponentHost sch : cluster.getServiceComponentHosts(hostname)) { execCmd.getLocalComponents().add(sch.getServiceComponentName()); } Map<String, String> commandParams = new TreeMap<>(); Map<String, ServiceInfo> serviceInfos = ambariMetaInfo.getServices(stackId.getStackName(), stackId.getStackVersion()); for (ServiceInfo serviceInfoInstance : serviceInfos.values()) { if (serviceInfoInstance.getServiceType() != null) { LOG.debug("Adding {} to command parameters for {}", serviceInfoInstance.getServiceType(), serviceInfoInstance.getName()); commandParams.put("dfs_type", serviceInfoInstance.getServiceType()); break; } } String commandTimeout = configs.getDefaultAgentTaskTimeout(false); if (serviceInfo.getSchemaVersion().equals(AmbariMetaInfo.SCHEMA_VERSION_2)) { CommandScriptDefinition script = serviceInfo.getCommandScript(); if (script != null) { commandParams.put(SCRIPT, script.getScript()); commandParams.put(SCRIPT_TYPE, script.getScriptType().toString()); if (script.getTimeout() > 0) { commandTimeout = String.valueOf(script.getTimeout()); } } else { String message = String.format("Service %s has no command script " + "defined. It is not possible to run service check" + " for this service", serviceName); throw new AmbariException(message); } } Long overriddenTimeout = configs.getAgentServiceCheckTaskTimeout(); if (!overriddenTimeout.equals(Configuration.AGENT_SERVICE_CHECK_TASK_TIMEOUT.getDefaultValue())) { commandTimeout = String.valueOf(overriddenTimeout); } commandParams.put(COMMAND_TIMEOUT, commandTimeout); String checkType = configHelper.getValueFromDesiredConfigurations(cluster, ConfigHelper.CLUSTER_ENV, ConfigHelper.SERVICE_CHECK_TYPE); if (ConfigHelper.SERVICE_CHECK_MINIMAL.equals(checkType)) { int actualTimeout = Integer.parseInt(commandParams.get(COMMAND_TIMEOUT)) / 2; actualTimeout = actualTimeout < MIN_STRICT_SERVICE_CHECK_TIMEOUT ? MIN_STRICT_SERVICE_CHECK_TIMEOUT : actualTimeout; commandParams.put(COMMAND_TIMEOUT, Integer.toString(actualTimeout)); } commandParams.put(SERVICE_PACKAGE_FOLDER, serviceInfo.getServicePackageFolder()); commandParams.put(HOOKS_FOLDER, stackInfo.getStackHooksFolder()); execCmd.setCommandParams(commandParams); if (actionParameters != null) { execCmd.setRoleParams(actionParameters); } }  void addServiceCheckAction(Stage stage, String hostname, String smokeTestRole,
      long nowTimestamp, String serviceName, String componentName,
      Map<String, String> actionParameters, boolean retryAllowed, boolean autoSkipFailure); void validateAction(ExecuteActionRequest actionRequest); void addExecutionCommandsToStage(ActionExecutionContext actionExecutionContext,
      Stage stage, Map<String, String> requestParams); String getRepoInfo(Cluster cluster, Host host); String getRepoInfo(Cluster cluster, String hostOSType, String hostOSFamily, String hostName); ExecuteCommandJson getCommandJson(ActionExecutionContext actionExecContext,
      Cluster cluster, StackId stackId); boolean isTopologyRefreshRequired(String actionName, String clusterName, String serviceName); }
AmbariCustomCommandExecutionHelper { public void addServiceCheckAction(Stage stage, String hostname, String smokeTestRole, long nowTimestamp, String serviceName, String componentName, Map<String, String> actionParameters, boolean retryAllowed, boolean autoSkipFailure) throws AmbariException { String clusterName = stage.getClusterName(); Cluster cluster = clusters.getCluster(clusterName); StackId stackId = cluster.getDesiredStackVersion(); AmbariMetaInfo ambariMetaInfo = managementController.getAmbariMetaInfo(); ServiceInfo serviceInfo = ambariMetaInfo.getService(stackId.getStackName(), stackId.getStackVersion(), serviceName); StackInfo stackInfo = ambariMetaInfo.getStack(stackId.getStackName(), stackId.getStackVersion()); stage.addHostRoleExecutionCommand(hostname, Role.valueOf(smokeTestRole), RoleCommand.SERVICE_CHECK, new ServiceComponentHostOpInProgressEvent(componentName, hostname, nowTimestamp), cluster.getClusterName(), serviceName, retryAllowed, autoSkipFailure); HostRoleCommand hrc = stage.getHostRoleCommand(hostname, smokeTestRole); if (hrc != null) { hrc.setCommandDetail(String.format("%s %s", RoleCommand.SERVICE_CHECK.toString(), serviceName)); } Map<String, Map<String, String>> configurations = new TreeMap<>(); Map<String, Map<String, Map<String, String>>> configurationAttributes = new TreeMap<>(); Map<String, Map<String, String>> configTags = new TreeMap<>(); ExecutionCommand execCmd = stage.getExecutionCommandWrapper(hostname, smokeTestRole).getExecutionCommand(); if(actionParameters != null && actionParameters.containsKey(KeyNames.REFRESH_CONFIG_TAGS_BEFORE_EXECUTION)){ execCmd.setForceRefreshConfigTagsBeforeExecution(true); } if (!execCmd.getForceRefreshConfigTagsBeforeExecution()) { configTags = managementController.findConfigurationTagsWithOverrides(cluster, hostname); } execCmd.setConfigurations(configurations); execCmd.setConfigurationAttributes(configurationAttributes); execCmd.setConfigurationTags(configTags); execCmd.setClusterHostInfo( StageUtils.getClusterHostInfo(cluster)); for (ServiceComponentHost sch : cluster.getServiceComponentHosts(hostname)) { execCmd.getLocalComponents().add(sch.getServiceComponentName()); } Map<String, String> commandParams = new TreeMap<>(); Map<String, ServiceInfo> serviceInfos = ambariMetaInfo.getServices(stackId.getStackName(), stackId.getStackVersion()); for (ServiceInfo serviceInfoInstance : serviceInfos.values()) { if (serviceInfoInstance.getServiceType() != null) { LOG.debug("Adding {} to command parameters for {}", serviceInfoInstance.getServiceType(), serviceInfoInstance.getName()); commandParams.put("dfs_type", serviceInfoInstance.getServiceType()); break; } } String commandTimeout = configs.getDefaultAgentTaskTimeout(false); if (serviceInfo.getSchemaVersion().equals(AmbariMetaInfo.SCHEMA_VERSION_2)) { CommandScriptDefinition script = serviceInfo.getCommandScript(); if (script != null) { commandParams.put(SCRIPT, script.getScript()); commandParams.put(SCRIPT_TYPE, script.getScriptType().toString()); if (script.getTimeout() > 0) { commandTimeout = String.valueOf(script.getTimeout()); } } else { String message = String.format("Service %s has no command script " + "defined. It is not possible to run service check" + " for this service", serviceName); throw new AmbariException(message); } } Long overriddenTimeout = configs.getAgentServiceCheckTaskTimeout(); if (!overriddenTimeout.equals(Configuration.AGENT_SERVICE_CHECK_TASK_TIMEOUT.getDefaultValue())) { commandTimeout = String.valueOf(overriddenTimeout); } commandParams.put(COMMAND_TIMEOUT, commandTimeout); String checkType = configHelper.getValueFromDesiredConfigurations(cluster, ConfigHelper.CLUSTER_ENV, ConfigHelper.SERVICE_CHECK_TYPE); if (ConfigHelper.SERVICE_CHECK_MINIMAL.equals(checkType)) { int actualTimeout = Integer.parseInt(commandParams.get(COMMAND_TIMEOUT)) / 2; actualTimeout = actualTimeout < MIN_STRICT_SERVICE_CHECK_TIMEOUT ? MIN_STRICT_SERVICE_CHECK_TIMEOUT : actualTimeout; commandParams.put(COMMAND_TIMEOUT, Integer.toString(actualTimeout)); } commandParams.put(SERVICE_PACKAGE_FOLDER, serviceInfo.getServicePackageFolder()); commandParams.put(HOOKS_FOLDER, stackInfo.getStackHooksFolder()); execCmd.setCommandParams(commandParams); if (actionParameters != null) { execCmd.setRoleParams(actionParameters); } }  void addServiceCheckAction(Stage stage, String hostname, String smokeTestRole,
      long nowTimestamp, String serviceName, String componentName,
      Map<String, String> actionParameters, boolean retryAllowed, boolean autoSkipFailure); void validateAction(ExecuteActionRequest actionRequest); void addExecutionCommandsToStage(ActionExecutionContext actionExecutionContext,
      Stage stage, Map<String, String> requestParams); String getRepoInfo(Cluster cluster, Host host); String getRepoInfo(Cluster cluster, String hostOSType, String hostOSFamily, String hostName); ExecuteCommandJson getCommandJson(ActionExecutionContext actionExecContext,
      Cluster cluster, StackId stackId); boolean isTopologyRefreshRequired(String actionName, String clusterName, String serviceName); static final Map<String, String> masterToSlaveMappingForDecom; final static String DECOM_INCLUDED_HOSTS; final static String DECOM_EXCLUDED_HOSTS; final static String DECOM_SLAVE_COMPONENT; final static String HBASE_MARK_DRAINING_ONLY; final static String UPDATE_EXCLUDE_FILE_ONLY; final static int MIN_STRICT_SERVICE_CHECK_TIMEOUT; static final String DECOMMISSION_COMMAND_NAME; }