stage.addHostRoleExecutionCommand(scHost.getHostName(), Role.valueOf(scHost
.getServiceComponentName()), command,
event, scHost.getClusterName(),
scHost.getServiceName());
ExecutionCommand execCmd = stage.getExecutionCommandWrapper(scHost.getHostName(),
scHost.getServiceComponentName()).getExecutionCommand();
// Generate cluster host info
execCmd.setClusterHostInfo(
StageUtils.getClusterHostInfo(
clusters.getHostsForCluster(cluster.getClusterName()), cluster, hostsMap, injector));
Host host = clusters.getHost(scHost.getHostName());
// Hack - Remove passwords from configs
if (event.getServiceComponentName().equals(Role.HIVE_CLIENT.toString())) {
Map<String, String> hiveConfigs = configurations.get(Configuration
.HIVE_CONFIG_TAG);
if (hiveConfigs != null) {
hiveConfigs.remove(Configuration.HIVE_METASTORE_PASSWORD_PROPERTY);
}
}
execCmd.setConfigurations(configurations);
execCmd.setConfigurationTags(configTags);
execCmd.setCommandParams(commandParams);
// send stack info to agent
StackId stackId = scHost.getDesiredStackVersion();
Map<String, List<RepositoryInfo>> repos = ambariMetaInfo.getRepository(
stackId.getStackName(), stackId.getStackVersion());
String repoInfo = "";
if (!repos.containsKey(host.getOsType())) {
// FIXME should this be an error?
LOG.warn("Could not retrieve repo information for host"
+ ", hostname=" + scHost.getHostName()
+ ", clusterName=" + cluster.getClusterName()
+ ", stackInfo=" + stackId.getStackId());
} else {
repoInfo = gson.toJson(repos.get(host.getOsType()));
}
if (LOG.isDebugEnabled()) {
LOG.debug("Sending repo information to agent"
+ ", hostname=" + scHost.getHostName()
+ ", clusterName=" + cluster.getClusterName()
+ ", stackInfo=" + stackId.getStackId()
+ ", repoInfo=" + repoInfo);
}
Map<String, String> params = new TreeMap<String, String>();
params.put("repo_info", repoInfo);
params.put("jdk_location", this.jdkResourceUrl);
params.put("stack_version", stackId.getStackVersion());
params.put("db_name", this.serverDB);
params.put("mysql_jdbc_url" , this.mysqljdbcUrl);
params.put("oracle_jdbc_url", this.ojdbcUrl);
if (configs.getServerDBName().equalsIgnoreCase(Configuration
.ORACLE_DB_NAME)) {
params.put("db_driver_filename", configs.getOjdbcJarName());
} else if (configs.getServerDBName().equalsIgnoreCase(Configuration
.MYSQL_DB_NAME)) {
params.put("db_driver_filename", configs.getMySQLJarName());
}
execCmd.setHostLevelParams(params);
Map<String, String> roleParams = new TreeMap<String, String>();
execCmd.setRoleParams(roleParams);
return;
}