Repository: ambari Updated Branches: refs/heads/branch-2.5 687d701af -> c2e51758f
AMBARI-19751: Credential Store params should be in the command json for RESTART Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c2e51758 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c2e51758 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c2e51758 Branch: refs/heads/branch-2.5 Commit: c2e51758f81bac1f0b1646e8f92846810799ce70 Parents: 687d701 Author: Nahappan Somasundaram <nsomasunda...@hortonworks.com> Authored: Fri Jan 27 09:56:03 2017 -0800 Committer: Nahappan Somasundaram <nsomasunda...@hortonworks.com> Committed: Fri Jan 27 12:32:33 2017 -0800 ---------------------------------------------------------------------- .../AmbariCustomCommandExecutionHelper.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/c2e51758/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java index 8b851ac..93f4a8f 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java @@ -175,6 +175,8 @@ public class AmbariCustomCommandExecutionHelper { @Inject private HostRoleCommandDAO hostRoleCommandDAO; + private Map<String, Map<String, Map<String, String>>> configCredentialsForService = new HashMap<>(); + protected static final String SERVICE_CHECK_COMMAND_NAME = "SERVICE_CHECK"; protected static final String START_COMMAND_NAME = "START"; protected static final String RESTART_COMMAND_NAME = "RESTART"; @@ -382,6 +384,20 @@ public class AmbariCustomCommandExecutionHelper { execCmd.setAvailableServicesFromServiceInfoMap(ambariMetaInfo.getServices(stackId.getStackName(), stackId.getStackVersion())); + // Get the value of credential store enabled from the DB + Service clusterService = cluster.getService(serviceName); + execCmd.setCredentialStoreEnabled(String.valueOf(clusterService.isCredentialStoreEnabled())); + + // Get the map of service config type to password properties for the service + Map<String, Map<String, String>> configCredentials; + configCredentials = configCredentialsForService.get(clusterService.getName()); + if (configCredentials == null) { + configCredentials = configHelper.getCredentialStoreEnabledProperties(stackId, clusterService); + configCredentialsForService.put(clusterService.getName(), configCredentials); + } + + execCmd.setConfigurationCredentials(configCredentials); + Map<String, String> hostLevelParams = new TreeMap<>(); hostLevelParams.put(CUSTOM_COMMAND, commandName);