[ https://issues.apache.org/jira/browse/AMBARI-22752?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16318434#comment-16318434 ]
ASF GitHub Bot commented on AMBARI-22752: ----------------------------------------- mpapirkovskyy closed pull request #74: [AMBARI-22752] Cannot enable security URL: https://github.com/apache/ambari/pull/74 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java index e9a480dd0fd..b016b7c4491 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java @@ -133,7 +133,7 @@ public ExecutionCommand() { private String componentName; @SerializedName("kerberosCommandParams") - @JsonIgnore + @com.fasterxml.jackson.annotation.JsonProperty("kerberosCommandParams") private List<Map<String, String>> kerberosCommandParams = new ArrayList<>(); @SerializedName("localComponents") diff --git a/ambari-server/src/main/java/org/apache/ambari/server/events/publishers/AgentCommandsPublisher.java b/ambari-server/src/main/java/org/apache/ambari/server/events/publishers/AgentCommandsPublisher.java index 2698bc357f5..6decb7f182e 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/events/publishers/AgentCommandsPublisher.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/events/publishers/AgentCommandsPublisher.java @@ -18,6 +18,10 @@ package org.apache.ambari.server.events.publishers; +import static org.apache.ambari.server.controller.KerberosHelperImpl.CHECK_KEYTABS; +import static org.apache.ambari.server.controller.KerberosHelperImpl.REMOVE_KEYTAB; +import static org.apache.ambari.server.controller.KerberosHelperImpl.SET_KEYTAB; + import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; @@ -116,7 +120,7 @@ private void populateExecutionCommandsClusters(Map<Long, TreeMap<String, Executi Map<String, String> hlp = ec.getCommandParams(); if (hlp != null) { String customCommand = hlp.get("custom_command"); - if ("SET_KEYTAB".equalsIgnoreCase(customCommand) || "REMOVE_KEYTAB".equalsIgnoreCase(customCommand)) { + if (SET_KEYTAB.equalsIgnoreCase(customCommand) || REMOVE_KEYTAB.equalsIgnoreCase(customCommand) || CHECK_KEYTABS.equalsIgnoreCase(customCommand)) { LOG.info(String.format("%s called", customCommand)); try { injectKeytab(ec, customCommand, clusters.getHostById(hostId).getHostName()); @@ -171,7 +175,7 @@ private void prepareExecutionCommandsClusters(Map<Long, TreeMap<String, Executio void injectKeytab(ExecutionCommand ec, String command, String targetHost) throws AmbariException { String dataDir = ec.getCommandParams().get(KerberosServerAction.DATA_DIRECTORY); - if (dataDir != null) { + if(dataDir != null) { KerberosIdentityDataFileReader reader = null; List<Map<String, String>> kcp = ec.getKerberosCommandParams(); @@ -183,7 +187,7 @@ void injectKeytab(ExecutionCommand ec, String command, String targetHost) throws if (targetHost.equalsIgnoreCase(hostName)) { - if ("SET_KEYTAB".equalsIgnoreCase(command)) { + if (SET_KEYTAB.equalsIgnoreCase(command)) { String keytabFilePath = record.get(KerberosIdentityDataFileReader.KEYTAB_FILE_PATH); if (keytabFilePath != null) { @@ -219,7 +223,7 @@ void injectKeytab(ExecutionCommand ec, String command, String targetHost) throws kcp.add(keytabMap); } } - } else if ("REMOVE_KEYTAB".equalsIgnoreCase(command)) { + } else if (REMOVE_KEYTAB.equalsIgnoreCase(command) || CHECK_KEYTABS.equalsIgnoreCase(command)) { Map<String, String> keytabMap = new HashMap<>(); keytabMap.put(KerberosIdentityDataFileReader.HOSTNAME, hostName); ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Cannot enable security > ---------------------- > > Key: AMBARI-22752 > URL: https://issues.apache.org/jira/browse/AMBARI-22752 > Project: Ambari > Issue Type: Bug > Components: ambari-server > Affects Versions: 3.0.0 > Reporter: Myroslav Papirkovskyi > Assignee: Myroslav Papirkovskyi > Priority: Critical > Fix For: 3.0.0 > > > During SET_KEYTAB and REMOVE_KEYTAB (only) we should send > kerberosCommandParams dictionary along with the command configs. -- This message was sent by Atlassian JIRA (v6.4.14#64029)