scHost.getServiceName());
String serviceName = scHost.getServiceName();
String componentName = event.getServiceComponentName();
String hostname = scHost.getHostName();
String osType = clusters.getHost(hostname).getOsType();
StackId stackId = cluster.getDesiredStackVersion();
ServiceInfo serviceInfo = ambariMetaInfo.getServiceInfo(stackId.getStackName(),
stackId.getStackVersion(), serviceName);
ComponentInfo componentInfo = ambariMetaInfo.getComponent(
stackId.getStackName(), stackId.getStackVersion(),
serviceName, componentName);
StackInfo stackInfo = ambariMetaInfo.getStackInfo(stackId.getStackName(),
stackId.getStackVersion());
ExecutionCommand execCmd = stage.getExecutionCommandWrapper(scHost.getHostName(),
scHost.getServiceComponentName()).getExecutionCommand();
Host host = clusters.getHost(scHost.getHostName());
// Hack - Remove passwords from configs
if (event.getServiceComponentName().equals(Role.HIVE_CLIENT.toString())) {
configHelper.applyCustomConfig(configurations, Configuration.HIVE_CONFIG_TAG,
Configuration.HIVE_METASTORE_PASSWORD_PROPERTY, "", true);
}
String jobtrackerHost = getJobTrackerHost(cluster);
if (!scHost.getHostName().equals(jobtrackerHost)) {
if (configTags.get(Configuration.GLOBAL_CONFIG_TAG) != null) {
configHelper.applyCustomConfig(
configurations, Configuration.GLOBAL_CONFIG_TAG,
Configuration.RCA_ENABLED_PROPERTY, "false", false);
}
}
execCmd.setConfigurations(configurations);
execCmd.setConfigurationTags(configTags);
if (commandParams == null) { // if not defined
commandParams = new TreeMap<String, String>();
}
commandParams.put(SCHEMA_VERSION, serviceInfo.getSchemaVersion());
// Get command script info for custom command/custom action
/*
* TODO: Custom actions are not supported yet, that's why we just pass
* component main commandScript to agent. This script is only used for
* default commads like INSTALL/STOP/START/CONFIGURE
*/
String commandTimeout = configs.getDefaultAgentTaskTimeout();
CommandScriptDefinition script = componentInfo.getCommandScript();
if (serviceInfo.getSchemaVersion().equals(AmbariMetaInfo.SCHEMA_VERSION_2)) {
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("Component %s of service %s has no " +
"command script defined", componentName, serviceName);
throw new AmbariException(message);
}
}
commandParams.put(COMMAND_TIMEOUT, commandTimeout);
commandParams.put(SERVICE_PACKAGE_FOLDER,
serviceInfo.getServicePackageFolder());
commandParams.put(HOOKS_FOLDER, stackInfo.getStackHooksFolder());
execCmd.setCommandParams(commandParams);
String repoInfo = customCommandExecutionHelper.getRepoInfo(cluster, host);
if (LOG.isDebugEnabled()) {
LOG.debug("Sending repo information to agent"
+ ", hostname=" + scHost.getHostName()
+ ", clusterName=" + cluster.getClusterName()
+ ", stackInfo=" + stackId.getStackId()
+ ", repoInfo=" + repoInfo);
}
Map<String, String> hostParams = new TreeMap<String, String>();
hostParams.put(REPO_INFO, repoInfo);
hostParams.put(JDK_LOCATION, getJdkResourceUrl());
hostParams.put(JAVA_HOME, getJavaHome());
hostParams.put(JDK_NAME, getJDKName());
hostParams.put(JCE_NAME, getJCEName());
hostParams.put(STACK_NAME, stackId.getStackName());
hostParams.put(STACK_VERSION, stackId.getStackVersion());
hostParams.put(DB_NAME, getServerDB());
hostParams.put(MYSQL_JDBC_URL, getMysqljdbcUrl());
hostParams.put(ORACLE_JDBC_URL, getOjdbcUrl());
hostParams.putAll(getRcaParameters());