ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rle...@apache.org
Subject ambari git commit: AMBARI-14327. Kerberos: all ambari server host ops are broken (rlevas)
Date Fri, 11 Dec 2015 11:31:42 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk baf230fdd -> edcf3ca7e


AMBARI-14327. Kerberos: all ambari server host ops are broken (rlevas)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/edcf3ca7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/edcf3ca7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/edcf3ca7

Branch: refs/heads/trunk
Commit: edcf3ca7e089093ab71b996dceb3148a44dfba36
Parents: baf230f
Author: Robert Levas <rlevas@hortonworks.com>
Authored: Fri Dec 11 06:31:28 2015 -0500
Committer: Robert Levas <rlevas@hortonworks.com>
Committed: Fri Dec 11 06:31:28 2015 -0500

----------------------------------------------------------------------
 .../controller/internal/TaskResourceProvider.java    | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/edcf3ca7/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskResourceProvider.java
index 72977d5..012c456 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskResourceProvider.java
@@ -39,6 +39,7 @@ import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
 import org.apache.ambari.server.orm.entities.HostRoleCommandEntity;
+import org.apache.ambari.server.utils.StageUtils;
 import org.codehaus.jackson.map.ObjectMapper;
 
 import com.google.inject.Inject;
@@ -153,7 +154,7 @@ public class TaskResourceProvider extends AbstractControllerResourceProvider
{
       setResourceProperty(resource, TASK_REQUEST_ID_PROPERTY_ID, hostRoleCommand.getRequestId(),
requestedIds);
       setResourceProperty(resource, TASK_ID_PROPERTY_ID, hostRoleCommand.getTaskId(), requestedIds);
       setResourceProperty(resource, TASK_STAGE_ID_PROPERTY_ID, hostRoleCommand.getStageId(),
requestedIds);
-      setResourceProperty(resource, TASK_HOST_NAME_PROPERTY_ID, hostRoleCommand.getHostName(),
requestedIds);
+      setResourceProperty(resource, TASK_HOST_NAME_PROPERTY_ID, ensureHostname(hostRoleCommand.getHostName()),
requestedIds);
       setResourceProperty(resource, TASK_ROLE_PROPERTY_ID, hostRoleCommand.getRole().toString(),
requestedIds);
       setResourceProperty(resource, TASK_COMMAND_PROPERTY_ID, hostRoleCommand.getRoleCommand(),
requestedIds);
       setResourceProperty(resource, TASK_STATUS_PROPERTY_ID, hostRoleCommand.getStatus(),
requestedIds);
@@ -227,4 +228,16 @@ public class TaskResourceProvider extends AbstractControllerResourceProvider
{
   protected Set<String> getPKPropertyIds() {
     return pkPropertyIds;
   }
+
+  /**
+   * Ensures that a hostname is returned. If null (indicating the host is the Ambari server),
the
+   * hostname of the Ambari server is returned.
+   *
+   * @param hostName a hostname
+   * @return the specified hostname or the hostname of the Ambari Server
+   */
+  protected String ensureHostname(String hostName) {
+    return (hostName == null) ? StageUtils.getHostName() : hostName;
+  }
+
 }


Mime
View raw message