ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vbrodets...@apache.org
Subject ambari git commit: AMBARI-10213. Add os_family to the hosts api.(vbrodetskyi)
Date Thu, 26 Mar 2015 15:37:26 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 8cdd1f550 -> 19b57e565


AMBARI-10213. Add os_family to the hosts api.(vbrodetskyi)


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

Branch: refs/heads/trunk
Commit: 19b57e565d793274b14894e34c9ba818b30e61db
Parents: 8cdd1f5
Author: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Authored: Thu Mar 26 17:36:24 2015 +0200
Committer: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Committed: Thu Mar 26 17:37:04 2015 +0200

----------------------------------------------------------------------
 .../controller/internal/HostResourceProvider.java    | 15 +++++++++++++++
 ambari-server/src/main/resources/properties.json     |  1 +
 2 files changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/19b57e56/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
index 3a359e5..ccd56bc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
@@ -59,6 +59,7 @@ import org.apache.ambari.server.state.MaintenanceState;
 import org.apache.ambari.server.state.SecurityType;
 import org.apache.ambari.server.state.ServiceComponentHost;
 import org.apache.ambari.server.state.configgroup.ConfigGroup;
+import org.apache.ambari.server.state.stack.OsFamily;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -93,6 +94,8 @@ public class HostResourceProvider extends BaseBlueprintProcessor {
       PropertyHelper.getPropertyId("Hosts", "os_arch");
   protected static final String HOST_OS_TYPE_PROPERTY_ID =
       PropertyHelper.getPropertyId("Hosts", "os_type");
+  protected static final String HOST_OS_FAMILY_PROPERTY_ID =
+      PropertyHelper.getPropertyId("Hosts", "os_family");
   protected static final String HOST_RACK_INFO_PROPERTY_ID =
       PropertyHelper.getPropertyId("Hosts", "rack_info");
   protected static final String HOST_LAST_HEARTBEAT_TIME_PROPERTY_ID =
@@ -131,6 +134,9 @@ public class HostResourceProvider extends BaseBlueprintProcessor {
   @Inject
   private MaintenanceStateHelper maintenanceStateHelper;
 
+  @Inject
+  private OsFamily osFamily;
+
   // ----- Constructors ----------------------------------------------------
 
   /**
@@ -224,6 +230,15 @@ public class HostResourceProvider extends BaseBlueprintProcessor {
           response.getOsArch(), requestedIds);
       setResourceProperty(resource, HOST_OS_TYPE_PROPERTY_ID,
           response.getOsType(), requestedIds);
+
+      String hostOsFamily = osFamily.find(response.getOsType());
+      if (hostOsFamily == null) {
+        LOG.error("Can not find host OS family. For OS type = '{}' and host name = '{}'",
+            response.getOsType(), response.getHostname());
+      }
+      setResourceProperty(resource, HOST_OS_FAMILY_PROPERTY_ID,
+          hostOsFamily, requestedIds);
+
       setResourceProperty(resource, HOST_RACK_INFO_PROPERTY_ID,
           response.getRackInfo(), requestedIds);
       setResourceProperty(resource, HOST_LAST_HEARTBEAT_TIME_PROPERTY_ID,

http://git-wip-us.apache.org/repos/asf/ambari/blob/19b57e56/ambari-server/src/main/resources/properties.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/properties.json b/ambari-server/src/main/resources/properties.json
index 4fee882..b230cb7 100644
--- a/ambari-server/src/main/resources/properties.json
+++ b/ambari-server/src/main/resources/properties.json
@@ -35,6 +35,7 @@
         "Hosts/ph_cpu_count",
         "Hosts/os_arch",
         "Hosts/os_type",
+        "Hosts/os_family",
         "Hosts/rack_info",
         "Hosts/last_heartbeat_time",
         "Hosts/last_agent_env",


Mime
View raw message