Prechádzať zdrojové kódy

AMBARI-6270. Repoinfo.xml should use family tag rather than type tag (aonishuk)

Andrew Onishuk 11 rokov pred
rodič
commit
32187893ed
50 zmenil súbory, kde vykonal 431 pridanie a 219 odobranie
  1. 33 23
      ambari-common/src/main/python/ambari_commons/os_check.py
  2. 44 0
      ambari-common/src/main/python/ambari_commons/resources/os_family.json
  3. 1 0
      ambari-server/conf/unix/ambari.properties
  4. 20 7
      ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
  5. 6 5
      ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java
  6. 3 1
      ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BootStrapImpl.java
  7. 16 3
      ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
  8. 3 1
      ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
  9. 1 0
      ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
  10. 5 0
      ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
  11. 4 2
      ambari-server/src/main/java/org/apache/ambari/server/state/stack/LatestRepoCallable.java
  12. 113 59
      ambari-server/src/main/java/org/apache/ambari/server/state/stack/OsFamily.java
  13. 5 5
      ambari-server/src/main/java/org/apache/ambari/server/state/stack/RepositoryXml.java
  14. 2 1
      ambari-server/src/main/java/org/apache/ambari/server/upgrade/StackUpgradeUtil.java
  15. 7 1
      ambari-server/src/main/python/ambari-server.py
  16. 5 1
      ambari-server/src/main/python/bootstrap.py
  17. 2 2
      ambari-server/src/main/python/os_check_type.py
  18. 1 1
      ambari-server/src/main/resources/stacks/BIGTOP/0.8/repos/repoinfo.xml
  19. 3 3
      ambari-server/src/main/resources/stacks/HDP/1.3.2/repos/repoinfo.xml
  20. 3 3
      ambari-server/src/main/resources/stacks/HDP/1.3.3/repos/repoinfo.xml
  21. 3 3
      ambari-server/src/main/resources/stacks/HDP/1.3/repos/repoinfo.xml
  22. 5 5
      ambari-server/src/main/resources/stacks/HDP/2.0.6.GlusterFS/repos/repoinfo.xml
  23. 3 3
      ambari-server/src/main/resources/stacks/HDP/2.0.6/repos/repoinfo.xml
  24. 3 3
      ambari-server/src/main/resources/stacks/HDP/2.0/repos/repoinfo.xml
  25. 3 3
      ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/repos/repoinfo.xml
  26. 4 4
      ambari-server/src/main/resources/stacks/HDP/2.1/repos/repoinfo.xml
  27. 4 4
      ambari-server/src/main/resources/stacks/HDP/2.2/repos/repoinfo.xml
  28. 4 0
      ambari-server/src/test/java/org/apache/ambari/server/agent/AgentResourceTest.java
  29. 2 2
      ambari-server/src/test/java/org/apache/ambari/server/api/services/UpdatePersistenceManagerTest.java
  30. 2 0
      ambari-server/src/test/java/org/apache/ambari/server/bootstrap/BootStrapTest.java
  31. 5 1
      ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
  32. 2 2
      ambari-server/src/test/java/org/apache/ambari/server/orm/InMemoryDefaultTestModule.java
  33. 1 0
      ambari-server/src/test/java/org/apache/ambari/server/orm/JdbcPropertyTest.java
  34. 1 0
      ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AuthorizationTestModule.java
  35. 1 0
      ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AuthorizationTestModuleForLdapDNWithSpace.java
  36. 1 0
      ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeTest.java
  37. 3 8
      ambari-server/src/test/python/TestOSCheck.py
  38. 44 0
      ambari-server/src/test/resources/os_family.json
  39. 2 2
      ambari-server/src/test/resources/stacks/HDP/0.1/repos/repoinfo.xml
  40. 2 2
      ambari-server/src/test/resources/stacks/HDP/0.2/repos/repoinfo.xml
  41. 8 8
      ambari-server/src/test/resources/stacks/HDP/1.2.0/repos/repoinfo.xml
  42. 8 8
      ambari-server/src/test/resources/stacks/HDP/1.3.0/repos/repoinfo.xml
  43. 6 6
      ambari-server/src/test/resources/stacks/HDP/1.3.1/repos/repoinfo.xml
  44. 6 6
      ambari-server/src/test/resources/stacks/HDP/2.0.1/repos/repoinfo.xml
  45. 6 6
      ambari-server/src/test/resources/stacks/HDP/2.0.5/repos/repoinfo.xml
  46. 6 6
      ambari-server/src/test/resources/stacks/HDP/2.0.6/repos/repoinfo.xml
  47. 6 6
      ambari-server/src/test/resources/stacks/HDP/2.0.7/repos/repoinfo.xml
  48. 6 6
      ambari-server/src/test/resources/stacks/HDP/2.0.8/repos/repoinfo.xml
  49. 6 6
      ambari-server/src/test/resources/stacks/HDP/2.1.1/repos/repoinfo.xml
  50. 1 1
      contrib/ambari-scom/metrics-sink/pom.xml

+ 33 - 23
ambari-common/src/main/python/ambari_commons/os_check.py

@@ -20,8 +20,17 @@ limitations under the License.
 
 import os
 import sys
+import json
 import platform
 
+# path to resources dir
+RESOURCES_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "resources")
+
+# family JSON data
+OSFAMILY_JSON_RESOURCE = "os_family.json"
+JSON_OS_TYPE = "distro"
+JSON_OS_VERSION = "versions"
+
 
 def linux_distribution():
   PYTHON_VER = sys.version_info[0] * 10 + sys.version_info[1]
@@ -37,33 +46,33 @@ def linux_distribution():
 
 
 class OS_CONST_TYPE(type):
-  # os families
-  REDHAT_FAMILY = 'redhat'
-  UBUNTU_FAMILY = 'ubuntu'
-  SUSE_FAMILY = 'suse'
 
   # Declare here os type mapping
-  OS_FAMILY_COLLECTION = [
-                            {'name': REDHAT_FAMILY,
-                             'os_list':
-                                ['redhat', 'fedora', 'centos', 'oraclelinux',
-                                 'ascendos', 'amazon', 'xenserver', 'oel', 'ovs',
-                                 'cloudlinux', 'slc', 'scientific', 'psbm',
-                                 'centos linux']
-                             },
-                            {'name': UBUNTU_FAMILY,
-                             'os_list': ['ubuntu', 'debian']
-                             },
-                            {'name': SUSE_FAMILY,
-                             'os_list': ['sles', 'sled', 'opensuse', 'suse']
-                             }
-                           ]
+  OS_FAMILY_COLLECTION = []
   # Would be generated from Family collection definition
   OS_COLLECTION = []
+  FAMILY_COLLECTION = []
+
+  def initialize_data(cls):
+    """
+      Initialize internal data structures from file
+    """
+    try:
+      f = open(os.path.join(RESOURCES_DIR, OSFAMILY_JSON_RESOURCE))
+      json_data = json.load(f)
+      f.close()
+      for family in json_data:
+        cls.FAMILY_COLLECTION += [family]
+        cls.OS_COLLECTION += json_data[family][JSON_OS_TYPE]
+        cls.OS_FAMILY_COLLECTION += [{
+          'name': family,
+          'os_list': json_data[family][JSON_OS_TYPE]
+        }]
+    except:
+      raise Exception("Couldn't load '%s' file" % OSFAMILY_JSON_RESOURCE)
 
   def __init__(cls, name, bases, dct):
-    for item in cls.OS_FAMILY_COLLECTION:
-      cls.OS_COLLECTION += item['os_list']
+    cls.initialize_data()
 
   def __getattr__(cls, name):
     """
@@ -76,8 +85,9 @@ class OS_CONST_TYPE(type):
     name = name.lower()
     if "os_" in name and name[3:] in cls.OS_COLLECTION:
       return name[3:]
-    else:
-      raise Exception("Unknown class property '%s'" % name)
+    if "_family" in name and name[:-7] in cls.FAMILY_COLLECTION:
+      return name[:-7]
+    raise Exception("Unknown class property '%s'" % name)
 
 
 class OSConst:

+ 44 - 0
ambari-common/src/main/python/ambari_commons/resources/os_family.json

@@ -0,0 +1,44 @@
+{
+  "redhat": {
+    "distro": [
+      "redhat",
+      "fedora",
+      "centos",
+      "oraclelinux",
+      "ascendos",
+      "amazon",
+      "xenserver",
+      "oel",
+      "ovs",
+      "cloudlinux",
+      "slc",
+      "scientific",
+      "psbm",
+      "centos linux"
+    ],
+    "versions": [
+      5,
+      6
+    ]
+  },
+  "ubuntu": {
+    "distro": [
+      "ubuntu",
+      "debian"
+    ],
+    "versions": [
+      12
+    ]
+  },
+  "suse": {
+    "distro": [
+      "sles",
+      "sled",
+      "opensuse",
+      "suse"
+    ],
+    "versions": [
+      11
+    ]
+  }
+}

+ 1 - 0
ambari-server/conf/unix/ambari.properties

@@ -18,6 +18,7 @@
 
 security.server.keys_dir = /var/lib/ambari-server/keys
 resources.dir = /var/lib/ambari-server/resources
+shared.resources.dir = /usr/lib/ambari-server/lib/ambari_commons/resources
 custom.action.definitions = /var/lib/ambari-server/resources/custom_action_definitions
 jdk1.6.url=http://public-repo-1.hortonworks.com/ARTIFACTS/jdk-6u31-linux-x64.bin
 jce_policy1.6.url=http://public-repo-1.hortonworks.com/ARTIFACTS/jce_policy-6.zip

+ 20 - 7
ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java

@@ -24,7 +24,6 @@ import java.io.FilenameFilter;
 import java.io.IOException;
 import java.lang.reflect.Type;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -72,6 +71,7 @@ import org.apache.ambari.server.state.stack.MetricDefinition;
 import org.apache.ambari.server.state.stack.RepositoryXml;
 import org.apache.ambari.server.state.stack.RepositoryXml.Os;
 import org.apache.ambari.server.state.stack.RepositoryXml.Repo;
+import org.apache.ambari.server.state.stack.OsFamily;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -121,9 +121,14 @@ public class AmbariMetaInfo {
   private static final String REPOSITORY_FOLDER_NAME = "repos";
   public static final String REPOSITORY_XML_PROPERTY_BASEURL = "baseurl";
   // all the supported OS'es
-  private static final List<String> ALL_SUPPORTED_OS = Arrays.asList(
-      "redhat7","centos7","centos5", "redhat5", "centos6", "redhat6", "oraclelinux5",
-      "oraclelinux6", "suse11", "sles11", "ubuntu12");
+  @Inject
+  private OsFamily os_family;
+
+  /**
+   * ALL_SUPPORTED_OS is dynamically generated list from loaded families from os_family.json
+   * Instead of append values here, please, add new families in json for tests and production
+   */
+  private List<String> ALL_SUPPORTED_OS;
 
   private final ActionDefinitionManager adManager = new ActionDefinitionManager();
   private String serverVersion = "undefined";
@@ -138,6 +143,8 @@ public class AmbariMetaInfo {
   @Inject
   Injector injector;
 
+  @Inject
+  Configuration cfg;
   /**
    * Alert Definition DAO used to merge stack definitions into the database.
    */
@@ -176,6 +183,8 @@ public class AmbariMetaInfo {
     stackRoot = new File(stackPath);
     serverVersionFile = new File(serverVersionFilePath);
     customActionRoot = new File(conf.getCustomActionDefinitionPath());
+    os_family = new OsFamily(conf);
+    ALL_SUPPORTED_OS = new ArrayList<String>(os_family.os_list());
   }
 
   public AmbariMetaInfo(File stackRoot, File serverVersionFile) throws Exception {
@@ -190,6 +199,10 @@ public class AmbariMetaInfo {
    */
   @Inject
   public void init() throws Exception {
+    // Need to be initialized before all actions
+    os_family = injector.getInstance(OsFamily.class);
+    ALL_SUPPORTED_OS = new ArrayList<String>(os_family.os_list());
+
     stacksResult = new ArrayList<StackInfo>();
     readServerVersion();
     getConfigurationInformation(stackRoot);
@@ -986,7 +999,7 @@ public class AmbariMetaInfo {
     List<RepositoryInfo> list = new ArrayList<RepositoryInfo>();
 
     for (Os o : rxml.getOses()) {
-      for (String os : o.getType().split(",")) {
+      for (String os : o.getFamily().split(",")) {
         for (Repo r : o.getRepos()) {
           RepositoryInfo ri = new RepositoryInfo();
           ri.setBaseUrl(r.getBaseUrl());
@@ -1000,7 +1013,7 @@ public class AmbariMetaInfo {
           if (null != metainfoDAO) {
             LOG.debug("Checking for override for base_url");
             String key = generateRepoMetaKey(r.getRepoName(), stack.getVersion(),
-                o.getType(), r.getRepoId(), REPOSITORY_XML_PROPERTY_BASEURL);
+                o.getFamily(), r.getRepoId(), REPOSITORY_XML_PROPERTY_BASEURL);
             MetainfoEntity entity = metainfoDAO.findByKey(key);
             if (null != entity) {
               ri.setBaseUrl(entity.getMetainfoValue());
@@ -1019,7 +1032,7 @@ public class AmbariMetaInfo {
 
     if (null != rxml.getLatestURI() && list.size() > 0) {
       lookupList.add(new LatestRepoCallable(rxml.getLatestURI(),
-          repositoryFile.getParentFile(), stack));
+          repositoryFile.getParentFile(), stack, os_family));
     }
 
     return list;

+ 6 - 5
ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java

@@ -52,13 +52,13 @@ class BSRunner extends Thread {
   private String ambariHostname;
   private boolean verbose;
   private BootStrapImpl bsImpl;
-  private final String clusterOsType;
+  private final String clusterOsFamily;
   private String projectVersion;
   private int serverPort;
 
   public BSRunner(BootStrapImpl impl, SshHostInfo sshHostInfo, String bootDir,
       String bsScript, String agentSetupScript, String agentSetupPassword,
-      int requestId, long timeout, String hostName, boolean isVerbose, String clusterOsType,
+      int requestId, long timeout, String hostName, boolean isVerbose, String clusterOsFamily,
       String projectVersion, int serverPort)
   {
     this.requestId = requestId;
@@ -71,7 +71,7 @@ class BSRunner extends Thread {
     this.agentSetupPassword = agentSetupPassword;
     this.ambariHostname = hostName;
     this.verbose = isVerbose;
-    this.clusterOsType = clusterOsType;
+    this.clusterOsFamily = clusterOsFamily;
     this.projectVersion = projectVersion;
     this.bsImpl = impl;
     this.serverPort = serverPort;
@@ -190,7 +190,7 @@ class BSRunner extends Thread {
       commands[4] = this.sshKeyFile.toString();
       commands[5] = this.agentSetupScript.toString();
       commands[6] = this.ambariHostname;
-      commands[7] = this.clusterOsType;
+      commands[7] = this.clusterOsFamily;
       commands[8] = this.projectVersion;
       commands[9] = this.serverPort+"";
       if (this.passwordFile != null) {
@@ -208,7 +208,8 @@ class BSRunner extends Thread {
       StringBuilder commandString = new StringBuilder();
       for (String comm : commands) {
         commandString.append(" " + comm);
-      }   
+      }
+
      
       if (LOG.isDebugEnabled()) {
         LOG.debug(commandString);

+ 3 - 1
ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BootStrapImpl.java

@@ -51,6 +51,7 @@ public class BootStrapImpl {
   int requestId = 0;
   private FifoLinkedHashMap<Long, BootStrapStatus> bsStatus;
   private final String clusterOsType;
+  private final String clusterOsFamily;
   private String projectVersion;
   private int serverPort;
 
@@ -64,6 +65,7 @@ public class BootStrapImpl {
     this.masterHostname = conf.getMasterHostname(
         InetAddress.getLocalHost().getCanonicalHostName());
     this.clusterOsType = conf.getServerOsType();
+    this.clusterOsFamily = conf.getServerOsFamily();
     this.projectVersion = ambariMetaInfo.getServerVersion();
     this.projectVersion = (this.projectVersion.equals(DEV_VERSION)) ? DEV_VERSION.replace("$", "") : this.projectVersion;
     this.serverPort = (conf.getApiSSLAuthentication())? conf.getClientSSLApiPort() : conf.getClientApiPort();
@@ -114,7 +116,7 @@ public class BootStrapImpl {
 
     bsRunner = new BSRunner(this, info, bootStrapDir.toString(),
         bootScript, bootSetupAgentScript, bootSetupAgentPassword, requestId, 0L,
-        this.masterHostname, info.isVerbose(), this.clusterOsType, this.projectVersion, this.serverPort);
+        this.masterHostname, info.isVerbose(), this.clusterOsFamily, this.projectVersion, this.serverPort);
     bsRunner.start();
     response.setStatus(BSRunStat.OK);
     response.setLog("Running Bootstrap now.");

+ 16 - 3
ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java

@@ -172,8 +172,8 @@ public class Configuration {
   public static final String HOSTNAME_MACRO = "{hostname}";
   public static final String JDBC_RCA_LOCAL_URL = "jdbc:postgresql://" + HOSTNAME_MACRO + "/ambarirca";
   public static final String JDBC_RCA_LOCAL_DRIVER = "org.postgresql.Driver";
-  public static final String OS_VERSION_KEY =
-      "server.os_type";
+  public static final String OS_FAMILY_KEY = "server.os_family";
+  public static final String OS_VERSION_KEY = "server.os_type";
   public static final String SRVR_HOSTS_MAPPING =
       "server.hosts.mapping";
   // Command parameter names
@@ -243,6 +243,7 @@ public class Configuration {
   public static final String AGENT_TASK_TIMEOUT_DEFAULT = "600";
 
   public static final String CUSTOM_ACTION_DEFINITION_KEY = "custom.action.definitions";
+  public static final String SHARED_RESOURCES_DIR_KEY = "shared.resources.dir";
   private static final String CUSTOM_ACTION_DEFINITION_DEF_VALUE =
       "/var/lib/ambari-server/resources/custom_action_definitions";
 
@@ -260,6 +261,7 @@ public class Configuration {
   private static final String PASSPHRASE_ENV_DEFAULT = "AMBARI_PASSPHRASE";
   private static final String RESOURCES_DIR_DEFAULT =
       "/var/lib/ambari-server/resources/";
+  private static final String SHARED_RESOURCES_DIR_DEFAULT = "/usr/lib/ambari-server/lib/ambari_commons/resources";
   private static final String ANONYMOUS_AUDIT_NAME_KEY = "anonymous.audit.name";
 
   private static final int CLIENT_API_PORT_DEFAULT = 8080;
@@ -377,6 +379,9 @@ public class Configuration {
     configsMap.put(SERVER_TMP_DIR_KEY, properties.getProperty(
             SERVER_TMP_DIR_KEY, SERVER_TMP_DIR_DEFAULT));
 
+    configsMap.put(SHARED_RESOURCES_DIR_KEY, properties.getProperty(
+       SHARED_RESOURCES_DIR_KEY, SHARED_RESOURCES_DIR_DEFAULT));
+
     File passFile = new File(configsMap.get(SRVR_KSTR_DIR_KEY) + File.separator
         + configsMap.get(SRVR_CRT_PASS_FILE_KEY));
     String password = null;
@@ -847,6 +852,10 @@ public class Configuration {
     return properties.getProperty(OS_VERSION_KEY, "");
   }
 
+  public String getServerOsFamily() {
+    return properties.getProperty(OS_FAMILY_KEY, "");
+  }
+
   public String getMasterHostname(String defaultValue) {
     return properties.getProperty(BOOTSTRAP_MASTER_HOSTNAME, defaultValue);
   }
@@ -885,7 +894,7 @@ public class Configuration {
 
   public int getConnectionMaxIdleTime() {
     return Integer.parseInt(properties.getProperty
-      (SERVER_CONNECTION_MAX_IDLE_TIME, String.valueOf("900000")));
+            (SERVER_CONNECTION_MAX_IDLE_TIME, String.valueOf("900000")));
   }
 
   /**
@@ -1044,6 +1053,10 @@ public class Configuration {
   public String getResourceDirPath() {
     return properties.getProperty(RESOURCES_DIR_KEY, RESOURCES_DIR_DEFAULT);
   }
+    
+  public String getSharedResourcesDirPath(){
+      return properties.getProperty(SHARED_RESOURCES_DIR_KEY, SHARED_RESOURCES_DIR_DEFAULT);
+  }
 
   public String getServerJDBCPostgresSchemaName() {
     return properties.getProperty(SERVER_JDBC_POSTGRES_SCHEMA_NAME, "");

+ 3 - 1
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java

@@ -120,6 +120,8 @@ public class AmbariCustomCommandExecutionHelper {
   private ConfigHelper configHelper;
   @Inject
   private MaintenanceStateHelper maintenanceStateHelper;
+  @Inject
+  private OsFamily os_family;
 
   protected static final String SERVICE_CHECK_COMMAND_NAME = "SERVICE_CHECK";
   protected static final String DECOMMISSION_COMMAND_NAME = "DECOMMISSION";
@@ -862,7 +864,7 @@ public class AmbariCustomCommandExecutionHelper {
         stackId.getStackName(), stackId.getStackVersion());
     String repoInfo = "";
 
-    String family = OsFamily.find(host.getOsType());
+    String family = os_family.find(host.getOsType());
     if (null == family)
       family = host.getOsFamily();
    

+ 1 - 0
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java

@@ -591,6 +591,7 @@ public class AmbariServer {
         injector.getInstance(GroupDAO.class), injector.getInstance(ViewInstanceDAO.class));
     ClusterPrivilegeResourceProvider.init(injector.getInstance(ClusterDAO.class));
     AmbariPrivilegeResourceProvider.init(injector.getInstance(ClusterDAO.class));
+
   }
 
   /**

+ 5 - 0
ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java

@@ -89,6 +89,7 @@ import org.apache.ambari.server.state.scheduler.RequestExecution;
 import org.apache.ambari.server.state.scheduler.RequestExecutionFactory;
 import org.apache.ambari.server.state.scheduler.RequestExecutionImpl;
 import org.apache.ambari.server.state.services.AlertNoticeDispatchService;
+import org.apache.ambari.server.state.stack.OsFamily;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostImpl;
 import org.apache.ambari.server.view.ViewInstanceHandlerList;
 import org.eclipse.jetty.server.SessionIdManager;
@@ -122,6 +123,7 @@ public class ControllerModule extends AbstractModule {
   private static Logger LOG = LoggerFactory.getLogger(ControllerModule.class);
 
   private final Configuration configuration;
+  private final OsFamily os_family;
   private final HostsMap hostsMap;
   private boolean dbInitNeeded;
   private final Gson prettyGson = new GsonBuilder().serializeNulls().setPrettyPrinting().create();
@@ -132,11 +134,13 @@ public class ControllerModule extends AbstractModule {
   public ControllerModule() throws Exception {
     configuration = new Configuration();
     hostsMap = new HostsMap(configuration);
+    os_family = new OsFamily(configuration);
   }
 
   public ControllerModule(Properties properties) throws Exception {
     configuration = new Configuration(properties);
     hostsMap = new HostsMap(configuration);
+    os_family = new OsFamily(configuration);
   }
 
 
@@ -193,6 +197,7 @@ public class ControllerModule extends AbstractModule {
     bind(SessionIdManager.class).toInstance(sessionIdManager);
 
     bind(Configuration.class).toInstance(configuration);
+    bind(OsFamily.class).toInstance(os_family);
     bind(HostsMap.class).toInstance(hostsMap);
     bind(PasswordEncoder.class).toInstance(new StandardPasswordEncoder());
     bind(DelegatingFilterProxy.class).toInstance(new DelegatingFilterProxy() {

+ 4 - 2
ambari-server/src/main/java/org/apache/ambari/server/state/stack/LatestRepoCallable.java

@@ -47,11 +47,13 @@ public class LatestRepoCallable implements Callable<Void> {
   private String sourceUri = null;
   private File stackRepoFolder = null;
   private StackInfo stack = null;
+  private OsFamily os_family;
 
-  public LatestRepoCallable(String latestSourceUri, File stackRepoFolder, StackInfo stack) {
+  public LatestRepoCallable(String latestSourceUri, File stackRepoFolder, StackInfo stack, OsFamily os_family) {
     this.sourceUri = latestSourceUri;
     this.stackRepoFolder = stackRepoFolder;
     this.stack = stack;
+    this.os_family = os_family;
   }
 
   @Override
@@ -151,7 +153,7 @@ public class LatestRepoCallable implements Callable<Void> {
       return osMap.get(os);
 
     // !!! os not found, find and return the first compatible one
-    Set<String> possibleTypes = OsFamily.findTypes(os);
+    Set<String> possibleTypes = os_family.findTypes(os);
 
     for (String type : possibleTypes) {
       if (osMap.containsKey(type))

+ 113 - 59
ambari-server/src/main/java/org/apache/ambari/server/state/stack/OsFamily.java

@@ -17,86 +17,140 @@
  */
 package org.apache.ambari.server.state.stack;
 
-import java.io.InputStream;
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.InputStreamReader;
 import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
+
+import com.google.inject.Singleton;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
 
+import org.apache.ambari.server.configuration.Configuration;
+
 /**
  * Class that encapsulates OS family logic
  */
+@Singleton
 public class OsFamily {
+    private final String os_pattern = "([^\\d]*)([\\d]*)";
+    private final String OS_DISTRO = "distro";
+    private final String OS_VERSION = "versions";
+    private final String LOAD_CONFIG_MSG = "Could not load OS family definition from %s file";
+    private final String FILE_NAME = "os_family.json";
+    private final Logger LOG = LoggerFactory.getLogger(OsFamily.class);
 
-  private static final String FILE_NAME = "os_family.json";
-  private static final Logger LOG = LoggerFactory.getLogger(OsFamily.class);
-  
-  private static Map<String, Set<String>> osMap = new HashMap<String, Set<String>>();
-  
-  static {
-    try {
-      InputStream inputStream = OsFamily.class.getClassLoader().getResourceAsStream(FILE_NAME);
-      if (null == inputStream)
-        inputStream = ClassLoader.getSystemResourceAsStream(FILE_NAME);
-      
-      Type type = new TypeToken<Map<String, Set<String>>>(){}.getType();
-      Gson gson = new Gson();
-      osMap = gson.fromJson(new InputStreamReader(inputStream), type);
-      
-    } catch (Exception e) {
-      LOG.error("Could not load OS family definition, using defaults");
-      osMap.put("centos5", new HashSet<String>());
-      osMap.put("centos6", new HashSet<String>());
-      osMap.put("suse11", new HashSet<String>());
-      osMap.put("ubuntu12", new HashSet<String>());
-      
-      Collections.addAll(osMap.get("centos5"), "centos5", "redhat5", "oraclelinux5", "rhel5");
-      Collections.addAll(osMap.get("centos6"), "centos6", "redhat6", "oraclelinux6", "rhel6");
-      Collections.addAll(osMap.get("suse11"), "suse11", "sles11", "opensuse11");
-      Collections.addAll(osMap.get("ubuntu12"), "ubuntu12");
-    }
-  }
-
+    private Map<String, Map<String, Set<String>>> osMap = null;
 
   /**
-   * Gets the array of compatible OS types
-   * @param os the os
-   * @return all types that are compatible with the supplied type
+   * Initialize object
+   * @param conf Configuration instance
    */
-  static Set<String> findTypes(String os) {
-    for (Entry<String, Set<String>> entry : osMap.entrySet()) {
-      for (String type : entry.getValue()) {
-        if (type.equals(os))
-          return Collections.unmodifiableSet(entry.getValue());
-      }
+    public OsFamily(Configuration conf){
+      init(conf.getSharedResourcesDirPath());
     }
-    return Collections.emptySet();
-  }
 
   /**
-   * Finds the family for the specific OS
-   * @param os the OS
-   * @return the family, or <code>null</code> if not defined
+   * Initialize object
+   * @param properties list of properties
    */
-  public static String find(String os) {
-    for (Entry<String, Set<String>> entry : osMap.entrySet()) {
-      for (String type : entry.getValue()) {
-        if (type.equals(os))
-          return entry.getKey();
+    public OsFamily(Properties properties){
+      init(properties.getProperty(Configuration.SHARED_RESOURCES_DIR_KEY));
+    }
+
+    private void init(String SharedResourcesPath){
+      try {
+        File f = new File(SharedResourcesPath, FILE_NAME);
+        if (!f.exists()) throw new Exception();
+        FileInputStream inputStream = new FileInputStream(f);
+
+        Type type = new TypeToken<Map<String, Map<String, Set<String>>>>() {}.getType();
+        Gson gson = new Gson();
+        osMap = gson.fromJson(new InputStreamReader(inputStream), type);
+        inputStream.close();
+      } catch (Exception e) {
+        LOG.error(String.format(LOAD_CONFIG_MSG, new File(SharedResourcesPath, FILE_NAME).toString()));
+        throw new RuntimeException(LOAD_CONFIG_MSG);
+      }
+    }
+
+
+    /**
+     * Separate os name from os major version
+     * @param os the os
+     * @return separated os name and os version
+     */
+    private Map<String,String> parse_os(String os){
+      Map<String,String> pos = new HashMap<String,String>();
+
+      Pattern r = Pattern.compile(os_pattern);
+      Matcher m = r.matcher(os);
+
+      if (m.find()){
+        pos.put(OS_DISTRO, m.group(1));
+        pos.put(OS_VERSION, m.group(2));
+      } else {
+        pos.put(OS_DISTRO, os);
+        pos.put(OS_VERSION, "");
+      }
+      return pos;
+    }
+
+    /**
+     * Gets the array of compatible OS types
+     * @param os the os
+     * @return all types that are compatible with the supplied type
+     */
+    public Set<String> findTypes(String os) {
+      Map<String,String>  pos = parse_os(os);
+      for ( String family : osMap.keySet()) {
+        Map<String, Set<String>> fam = osMap.get(family);
+        if (fam.get(OS_DISTRO).contains(pos.get(OS_DISTRO)) && fam.get(OS_VERSION).contains(pos.get(OS_VERSION))){
+          Set<String> data=new HashSet<String>();
+          for (String item: fam.get(OS_DISTRO)) data.add(item + pos.get(OS_VERSION));
+            return Collections.unmodifiableSet(data);
+        }
       }
+      return Collections.emptySet();
     }
-    
-    return null;
-  }
 
-}
+    /**
+     * Finds the family for the specific OS
+     * @param os the OS
+     * @return the family, or <code>null</code> if not defined
+     */
+    public String find(String os) {
+      Map<String,String>  pos = parse_os(os);
+      for ( String family : osMap.keySet()) {
+        Map<String, Set<String>> fam = osMap.get(family);
+        if (fam.get(OS_DISTRO).contains(pos.get(OS_DISTRO)) && fam.get(OS_VERSION).contains(pos.get(OS_VERSION))){
+          return family + pos.get(OS_VERSION);
+        }
+      }
+      return null;
+    }
+
+    /**
+     * Form list of all supported os types
+     * @return one dimension list with os types
+     */
+    public Set<String> os_list(){
+      Set<String> r= new HashSet<String>();
+      for ( String family : osMap.keySet()) {
+        Map<String, Set<String>> fam = osMap.get(family);
+        for (String version: fam.get(OS_VERSION)){
+          Set<String> data=new HashSet<String>();
+          for (String item: fam.get(OS_DISTRO)) data.add(item + version);
+          r.addAll(data);
+        }
+      }
+      return r;
+    }
+}

+ 5 - 5
ambari-server/src/main/java/org/apache/ambari/server/state/stack/RepositoryXml.java

@@ -57,8 +57,8 @@ public class RepositoryXml {
    */
   @XmlAccessorType(XmlAccessType.FIELD)
   public static class Os {
-    @XmlAttribute(name="type")
-    private String type;
+    @XmlAttribute(name="family")
+    private String family;
     
     @XmlElement(name="repo")
     private List<Repo> repos;
@@ -67,10 +67,10 @@ public class RepositoryXml {
     }
     
     /**
-     * @return the os type
+     * @return the os family
      */
-    public String getType() {
-      return type;
+    public String getFamily() {
+      return family;
     }
     
     /**

+ 2 - 1
ambari-server/src/main/java/org/apache/ambari/server/upgrade/StackUpgradeUtil.java

@@ -170,6 +170,7 @@ public class StackUpgradeUtil {
     
     AmbariMetaInfo ami = injector.getInstance(AmbariMetaInfo.class);
     MetainfoDAO metaDao = injector.getInstance(MetainfoDAO.class);
+    OsFamily os_family = injector.getInstance(OsFamily.class);
     
     String stackRepoId = stackName + "-" + stackVersion;
     
@@ -183,7 +184,7 @@ public class StackUpgradeUtil {
     } else {
       for (String os : oses) {
         
-        String family = OsFamily.find(os);
+        String family = os_family.find(os);
         if (null != family) {
           String key = ami.generateRepoMetaKey(stackName, stackVersion, os,
               stackRepoId, AmbariMetaInfo.REPOSITORY_XML_PROPERTY_BASEURL);

+ 7 - 1
ambari-server/src/main/python/ambari-server.py

@@ -412,6 +412,7 @@ JAVA_HOME_PROPERTY = "java.home"
 JDK_NAME_PROPERTY = "jdk.name"
 JCE_NAME_PROPERTY = "jce.name"
 OS_TYPE_PROPERTY = "server.os_type"
+OS_FAMILY_PROPERTY = "server.os_family"
 GET_FQDN_SERVICE_URL = "server.fqdn.service.url"
 
 JDK_DOWNLOAD_CMD = "curl --create-dirs -o {0} {1}"
@@ -2065,7 +2066,12 @@ def configure_os_settings():
     print_error_msg("Non-Linux systems are not supported")
     return -1
 
-  master_os_type = OS_FAMILY + OS_VERSION
+  # to check server/agent compatibility
+  master_os_family = OS_FAMILY + OS_VERSION
+  # to check supported os_types
+  master_os_type = OS_TYPE + OS_VERSION
+
+  write_property(OS_FAMILY_PROPERTY, master_os_family)
   write_property(OS_TYPE_PROPERTY, master_os_type)
   return 0
 

+ 5 - 1
ambari-server/src/main/python/bootstrap.py

@@ -405,6 +405,7 @@ class Bootstrap(threading.Thread):
     self.host_log.write("\n")
     return retcode
 
+
   def runSetupAgent(self):
     params = self.shared_state
     self.host_log.write("==========================\n")
@@ -416,6 +417,7 @@ class Bootstrap(threading.Thread):
     self.host_log.write("\n")
     return retcode
 
+
   def createDoneFile(self, retcode):
     """ Creates .done file for current host. These files are later read from Java code.
     If .done file for any host is not created, the bootstrap will hang or fail due to timeout"""
@@ -429,7 +431,7 @@ class Bootstrap(threading.Thread):
   def getServerFamily(self):
     '''Return server OS family and version'''
     cot = re.search("([^\d]+)([\d]*)", self.shared_state.cluster_os_type)
-    return cot.group(1).lower(), cot.group(2).lower()
+    return cot.group(1).lower(),cot.group(2).lower()
 
   def checkSudoPackage(self):
     """ Checking 'sudo' package on remote host """
@@ -468,6 +470,7 @@ class Bootstrap(threading.Thread):
     self.host_log.write("Copying password file finished")
     return max(retcode1["exitstatus"], retcode2["exitstatus"])
 
+
   def changePasswordFileModeOnHost(self):
     # Change password file mode to 600
     self.host_log.write("Changing password file mode...")
@@ -479,6 +482,7 @@ class Bootstrap(threading.Thread):
     self.host_log.write("Change password file mode on host finished")
     return retcode
 
+
   def deletePasswordFile(self):
     # Deleting the password file
     self.host_log.write("Deleting password file...")

+ 2 - 2
ambari-server/src/main/python/os_check_type.py

@@ -32,12 +32,12 @@ def main(argv=None):
   current_os = OSCheck.get_os_family() + OSCheck.get_os_major_version()
 
   # If agent/server have the same {"family","main_version"} - then ok.
-  print "Cluster primary/cluster OS type is %s and local/current OS type is %s" % (
+  print "Cluster primary/cluster OS family is %s and local/current OS family is %s" % (
     cluster_os, current_os)
   if current_os == cluster_os:
     sys.exit(0)
   else:
-    raise Exception("Local OS is not compatible with cluster primary OS. Please perform manual bootstrap on this host.")
+    raise Exception("Local OS is not compatible with cluster primary OS family. Please perform manual bootstrap on this host.")
 
 
 if __name__ == "__main__":

+ 1 - 1
ambari-server/src/main/resources/stacks/BIGTOP/0.8/repos/repoinfo.xml

@@ -19,7 +19,7 @@
   <!-- TODO define latest json file for bigtop 
   <latest>http://s3.amazonaws.com/dev.hortonworks.com/HDP/hdp_urlinfo.json</latest>
   -->
-  <os type="redhat6">
+  <os family="redhat6">
     <repo>
       <baseurl>http://bigtop01.cloudera.org:8080/job/Bigtop-trunk-Repository/label=centos6/lastSuccessfulBuild/artifact/repo/</baseurl>
       <repoid>BIGTOP-0.8</repoid>

+ 3 - 3
ambari-server/src/main/resources/stacks/HDP/1.3.2/repos/repoinfo.xml

@@ -16,7 +16,7 @@
    limitations under the License.
 -->
 <reposinfo>
-  <os type="redhat6">
+  <os family="redhat6">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos6/1.x/updates/1.3.2.0</baseurl>
       <repoid>HDP-1.3.2</repoid>
@@ -28,7 +28,7 @@
       <reponame>HDP-UTILS</reponame>
     </repo>
   </os>
-  <os type="redhat5">
+  <os family="redhat5">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos5/1.x/updates/1.3.2.0</baseurl>
       <repoid>HDP-1.3.2</repoid>
@@ -40,7 +40,7 @@
       <reponame>HDP-UTILS</reponame>
     </repo>
   </os>
-  <os type="suse11">
+  <os family="suse11">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/suse11/1.x/updates/1.3.2.0</baseurl>
       <repoid>HDP-1.3.2</repoid>

+ 3 - 3
ambari-server/src/main/resources/stacks/HDP/1.3.3/repos/repoinfo.xml

@@ -16,7 +16,7 @@
    limitations under the License.
 -->
 <reposinfo>
-  <os type="redhat6">
+  <os family="redhat6">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos6/1.x/updates/1.3.3.0</baseurl>
       <repoid>HDP-1.3.3</repoid>
@@ -28,7 +28,7 @@
       <reponame>HDP-UTILS</reponame>
     </repo>
   </os>
-  <os type="redhat5">
+  <os family="redhat5">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos5/1.x/updates/1.3.3.0</baseurl>
       <repoid>HDP-1.3.3</repoid>
@@ -40,7 +40,7 @@
       <reponame>HDP-UTILS</reponame>
     </repo>
   </os>
-  <os type="suse11">
+  <os family="suse11">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/suse11/1.x/updates/1.3.3.0</baseurl>
       <repoid>HDP-1.3.3</repoid>

+ 3 - 3
ambari-server/src/main/resources/stacks/HDP/1.3/repos/repoinfo.xml

@@ -17,7 +17,7 @@
 -->
 <reposinfo>
   <latest>http://s3.amazonaws.com/dev.hortonworks.com/HDP/hdp_urlinfo.json</latest>
-  <os type="redhat6">
+  <os family="redhat6">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos6/1.x/updates/1.3.7.0</baseurl>
       <repoid>HDP-1.3</repoid>
@@ -29,7 +29,7 @@
       <reponame>HDP-UTILS</reponame>
     </repo>
   </os>
-  <os type="redhat5">
+  <os family="redhat5">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos5/1.x/updates/1.3.7.0</baseurl>
       <repoid>HDP-1.3</repoid>
@@ -41,7 +41,7 @@
       <reponame>HDP-UTILS</reponame>
     </repo>
   </os>
-  <os type="suse11">
+  <os family="suse11">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/suse11/1.x/updates/1.3.7.0</baseurl>
       <repoid>HDP-1.3</repoid>

+ 5 - 5
ambari-server/src/main/resources/stacks/HDP/2.0.6.GlusterFS/repos/repoinfo.xml

@@ -16,7 +16,7 @@
    limitations under the License.
 -->
 <reposinfo>
-  <os type="centos6">
+  <os family="centos6">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.0.6.GlusterFS</repoid>
@@ -28,7 +28,7 @@
       <reponame>HDP-UTILS</reponame>
     </repo>    
   </os>
-  <os type="centos5">
+  <os family="centos5">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos5/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.0.6.GlusterFS</repoid>
@@ -40,7 +40,7 @@
       <reponame>HDP-UTILS</reponame>
     </repo>    
   </os>
-  <os type="redhat6">
+  <os family="redhat6">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.0.6.GlusterFS</repoid>
@@ -52,7 +52,7 @@
       <reponame>HDP-UTILS</reponame>
     </repo>     
   </os>
-  <os type="redhat5">
+  <os family="redhat5">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos5/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.0.6.GlusterFS</repoid>
@@ -64,7 +64,7 @@
       <reponame>HDP-UTILS</reponame>
     </repo>     
   </os>
-  <os type="suse11">
+  <os family="suse11">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/suse11/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.0.6.GlusterFS</repoid>

+ 3 - 3
ambari-server/src/main/resources/stacks/HDP/2.0.6/repos/repoinfo.xml

@@ -16,7 +16,7 @@
    limitations under the License.
 -->
 <reposinfo>
-  <os type="redhat6">
+  <os family="redhat6">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.1</baseurl>
       <repoid>HDP-2.0.6</repoid>
@@ -28,7 +28,7 @@
       <reponame>HDP-UTILS</reponame>
     </repo>
   </os>
-  <os type="redhat5">
+  <os family="redhat5">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos5/2.x/updates/2.0.6.1</baseurl>
       <repoid>HDP-2.0.6</repoid>
@@ -40,7 +40,7 @@
       <reponame>HDP-UTILS</reponame>
     </repo>
   </os>
-  <os type="suse11">
+  <os family="suse11">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/suse11/2.x/updates/2.0.6.1</baseurl>
       <repoid>HDP-2.0.6</repoid>

+ 3 - 3
ambari-server/src/main/resources/stacks/HDP/2.0/repos/repoinfo.xml

@@ -17,7 +17,7 @@
 -->
 <reposinfo>
   <latest>http://s3.amazonaws.com/dev.hortonworks.com/HDP/hdp_urlinfo.json</latest>
-  <os type="redhat6">
+  <os family="redhat6">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.10.0</baseurl>
       <repoid>HDP-2.0</repoid>
@@ -29,7 +29,7 @@
       <reponame>HDP-UTILS</reponame>
     </repo>
   </os>
-  <os type="redhat5">
+  <os family="redhat5">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos5/2.x/updates/2.0.10.0</baseurl>
       <repoid>HDP-2.0</repoid>
@@ -41,7 +41,7 @@
       <reponame>HDP-UTILS</reponame>
     </repo>
   </os>
-  <os type="suse11">
+  <os family="suse11">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/suse11/2.x/updates/2.0.10.0</baseurl>
       <repoid>HDP-2.0</repoid>

+ 3 - 3
ambari-server/src/main/resources/stacks/HDP/2.1.GlusterFS/repos/repoinfo.xml

@@ -18,7 +18,7 @@
 <reposinfo>
   <!--<latest>http://public-repo-1.hortonworks.com/HDP/hdp_urlinfo.json</latest>-->
   <latest>http://s3.amazonaws.com/dev.hortonworks.com/HDP/hdp_urlinfo.json</latest>
-  <os type="redhat6">
+  <os family="redhat6">
     <repo>
       <!--<baseurl>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.1.2.0</baseurl>-->
       <baseurl>REPLACE_WITH_CENTOS6_URL</baseurl>
@@ -31,7 +31,7 @@
       <reponame>HDP-UTILS</reponame>
     </repo>
   </os>
-  <os type="redhat5">
+  <os family="redhat5">
     <repo>
       <baseurl>REPLACE_WITH_CENTOS5_URL</baseurl>      
       <repoid>HDP-2.1</repoid>
@@ -43,7 +43,7 @@
       <reponame>HDP-UTILS</reponame>
     </repo>
   </os>
-  <os type="suse11">
+  <os family="suse11">
     <repo>
       <baseurl>REPLACE_WITH_SUSE11_URL</baseurl>      
       <repoid>HDP-2.1</repoid>

+ 4 - 4
ambari-server/src/main/resources/stacks/HDP/2.1/repos/repoinfo.xml

@@ -17,7 +17,7 @@
 -->
 <reposinfo>
   <latest>http://s3.amazonaws.com/dev.hortonworks.com/HDP/hdp_urlinfo.json</latest>
-  <os type="redhat6">
+  <os family="redhat6">
     <repo>
       <baseurl>REPLACE_WITH_CENTOS6_URL</baseurl>
       <repoid>HDP-2.1</repoid>
@@ -29,7 +29,7 @@
       <reponame>HDP-UTILS</reponame>
     </repo>
   </os>
-  <os type="redhat5">
+  <os family="redhat5">
     <repo>
       <baseurl>REPLACE_WITH_CENTOS5_URL</baseurl>
       <repoid>HDP-2.1</repoid>
@@ -41,7 +41,7 @@
       <reponame>HDP-UTILS</reponame>
     </repo>
   </os>
-  <os type="suse11">
+  <os family="suse11">
     <repo>
       <baseurl>REPLACE_WITH_SUSE11_URL</baseurl>
       <repoid>HDP-2.1</repoid>
@@ -53,7 +53,7 @@
       <reponame>HDP-UTILS</reponame>
     </repo>
   </os>
-  <os type="ubuntu12">
+  <os family="ubuntu12">
     <repo>
       <baseurl>REPLACE_WITH_UBUNTU12_URL</baseurl>
       <repoid>HDP-2.1</repoid>

+ 4 - 4
ambari-server/src/main/resources/stacks/HDP/2.2/repos/repoinfo.xml

@@ -17,7 +17,7 @@
 -->
 <reposinfo>
   <latest>http://s3.amazonaws.com/dev.hortonworks.com/HDP/hdp_urlinfo.json</latest>
-  <os type="redhat6">
+  <os family="redhat6">
     <repo>
       <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos6/2.x/updates/2.2.0.0</baseurl>
       <repoid>HDP-2.2</repoid>
@@ -29,7 +29,7 @@
       <reponame>HDP-UTILS</reponame>
     </repo>
   </os>
-  <os type="redhat5">
+  <os family="redhat5">
     <repo>
       <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos5/2.x/updates/2.2.0.0</baseurl>
       <repoid>HDP-2.2</repoid>
@@ -41,7 +41,7 @@
       <reponame>HDP-UTILS</reponame>
     </repo>
   </os>
-  <os type="suse11">
+  <os family="suse11">
     <repo>
       <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP/sles11sp1/2.x/updates/2.2.0.0</baseurl>
       <repoid>HDP-2.2</repoid>
@@ -53,7 +53,7 @@
       <reponame>HDP-UTILS</reponame>
     </repo>
   </os>
-  <os type="ubuntu12">
+  <os family="ubuntu12">
     <repo>
       <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP/ubuntu12/2.x/updates/2.2.0.0</baseurl>
       <repoid>HDP-2.2</repoid>

+ 4 - 0
ambari-server/src/test/java/org/apache/ambari/server/agent/AgentResourceTest.java

@@ -69,6 +69,7 @@ import org.apache.ambari.server.state.host.HostImpl;
 import org.apache.ambari.server.state.scheduler.RequestExecution;
 import org.apache.ambari.server.state.scheduler.RequestExecutionFactory;
 import org.apache.ambari.server.state.scheduler.RequestExecutionImpl;
+import org.apache.ambari.server.state.stack.OsFamily;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostImpl;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -89,6 +90,7 @@ public class AgentResourceTest extends JerseyTest {
   ActionManager actionManager;
   Injector injector;
   AmbariMetaInfo ambariMetaInfo;
+  OsFamily os_family;
   ActionDBAccessor actionDBAccessor;
 
   public AgentResourceTest() {
@@ -282,9 +284,11 @@ public class AgentResourceTest extends JerseyTest {
       }
       requestStaticInjection(AgentResource.class);
       bind(Clusters.class).to(ClustersImpl.class);
+      os_family = mock(OsFamily.class);
       actionManager = mock(ActionManager.class);
       ambariMetaInfo = mock(AmbariMetaInfo.class);
       actionDBAccessor = mock(ActionDBAccessor.class);
+      bind(OsFamily.class).toInstance(os_family);
       bind(ActionDBAccessor.class).toInstance(actionDBAccessor);
       bind(ActionManager.class).toInstance(actionManager);
       bind(AgentCommand.class).to(ExecutionCommand.class);

+ 2 - 2
ambari-server/src/test/java/org/apache/ambari/server/api/services/UpdatePersistenceManagerTest.java

@@ -59,7 +59,7 @@ public class UpdatePersistenceManagerTest {
 //
 //    //expectations
 //    expect(resource.getResourceDefinition()).andReturn(resourceDefinition);
-//    expect(resourceDefinition.getType()).andReturn(Resource.Type.Component);
+//    expect(resourceDefinition.getFamily()).andReturn(Resource.Type.Component);
 //    expect(resource.getQuery()).andReturn(query);
 //    expect(query.getPredicate()).andReturn(predicate);
 //
@@ -116,7 +116,7 @@ public class UpdatePersistenceManagerTest {
 //
 //    //expectations
 //    expect(resource.getResourceDefinition()).andReturn(resourceDefinition);
-//    expect(resourceDefinition.getType()).andReturn(Resource.Type.Component);
+//    expect(resourceDefinition.getFamily()).andReturn(Resource.Type.Component);
 //    expect(resource.getQuery()).andReturn(query);
 //    expect(query.getPredicate()).andReturn(predicate);
 //

+ 2 - 0
ambari-server/src/test/java/org/apache/ambari/server/bootstrap/BootStrapTest.java

@@ -71,6 +71,7 @@ public class BootStrapTest extends TestCase {
     properties.setProperty(Configuration.SRVR_KSTR_DIR_KEY, "target" + File.separator + "classes");
     properties.setProperty(Configuration.METADETA_DIR_PATH, metadetadir);
     properties.setProperty(Configuration.SERVER_VERSION_FILE, serverVersionFilePath);
+    properties.setProperty(Configuration.SHARED_RESOURCES_DIR_KEY, "src/test/resources/");
     Configuration conf = new Configuration(properties);
     AmbariMetaInfo ambariMetaInfo = new AmbariMetaInfo(conf);
     BootStrapImpl impl = new BootStrapImpl(conf, ambariMetaInfo);
@@ -118,6 +119,7 @@ public class BootStrapTest extends TestCase {
         properties.setProperty(Configuration.SRVR_KSTR_DIR_KEY, "target" + File.separator + "classes");
         properties.setProperty(Configuration.METADETA_DIR_PATH, metadetadir);
         properties.setProperty(Configuration.SERVER_VERSION_FILE, serverVersionFilePath);
+      properties.setProperty(Configuration.SHARED_RESOURCES_DIR_KEY, "src/test/resources/");
         Configuration conf = new Configuration(properties);
         AmbariMetaInfo ambariMetaInfo = new AmbariMetaInfo(conf);
         BootStrapImpl impl = new BootStrapImpl(conf, ambariMetaInfo);

+ 5 - 1
ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java

@@ -115,6 +115,7 @@ import org.apache.ambari.server.state.StackInfo;
 import org.apache.ambari.server.state.State;
 import org.apache.ambari.server.state.configgroup.ConfigGroup;
 import org.apache.ambari.server.state.configgroup.ConfigGroupFactory;
+import org.apache.ambari.server.state.stack.OsFamily;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostInstallEvent;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostOpSucceededEvent;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostStartEvent;
@@ -8725,6 +8726,7 @@ public class AmbariManagementControllerTest {
             "target/version");
         properties.setProperty(Configuration.OS_VERSION_KEY,
             "centos6");
+        properties.setProperty(Configuration.SHARED_RESOURCES_DIR_KEY, "src/test/resources/");
         try {
           install(new ControllerModule(properties));
         } catch (Exception e) {
@@ -8799,7 +8801,7 @@ public class AmbariManagementControllerTest {
         properties.setProperty(Configuration.SERVER_VERSION_FILE,
             "../version");
         properties.setProperty(Configuration.OS_VERSION_KEY, "centos6");
-
+        properties.setProperty(Configuration.SHARED_RESOURCES_DIR_KEY, "src/test/resources/");
         try {
           install(new ControllerModule(properties));
         } catch (Exception e) {
@@ -8908,6 +8910,7 @@ public class AmbariManagementControllerTest {
             "target/version");
         properties.setProperty(Configuration.OS_VERSION_KEY,
             "centos5");
+        properties.setProperty(Configuration.SHARED_RESOURCES_DIR_KEY, "src/test/resources/");
         try {
           install(new ControllerModule(properties));
         } catch (Exception e) {
@@ -9236,6 +9239,7 @@ public class AmbariManagementControllerTest {
         properties.setProperty(Configuration.SERVER_VERSION_FILE,
             "../version");
         properties.setProperty(Configuration.OS_VERSION_KEY, OS_TYPE);
+        properties.setProperty(Configuration.SHARED_RESOURCES_DIR_KEY, "src/test/resources/");
         try {
           install(new ControllerModule(properties));
         } catch (Exception e) {

+ 2 - 2
ambari-server/src/test/java/org/apache/ambari/server/orm/InMemoryDefaultTestModule.java

@@ -21,8 +21,6 @@ package org.apache.ambari.server.orm;
 import com.google.inject.AbstractModule;
 import org.apache.ambari.server.configuration.Configuration;
 import org.apache.ambari.server.controller.ControllerModule;
-import org.apache.ambari.server.scheduler.ExecutionScheduleManagerTest;
-import org.apache.ambari.server.scheduler.ExecutionScheduler;
 
 import java.util.Properties;
 
@@ -38,6 +36,8 @@ public class InMemoryDefaultTestModule extends AbstractModule {
             "target/version");
     properties.setProperty(Configuration.OS_VERSION_KEY,
         "centos5");
+    properties.setProperty(Configuration.SHARED_RESOURCES_DIR_KEY, "src/test/resources/");
+
     try {
       install(new ControllerModule(properties));
     } catch (Exception e) {

+ 1 - 0
ambari-server/src/test/java/org/apache/ambari/server/orm/JdbcPropertyTest.java

@@ -42,6 +42,7 @@ public class JdbcPropertyTest {
     properties.setProperty(Configuration.METADETA_DIR_PATH, "src/test/resources/stacks");
     properties.setProperty(Configuration.SERVER_VERSION_FILE, "target/version");
     properties.setProperty(Configuration.OS_VERSION_KEY, "centos5");
+    properties.setProperty(Configuration.SHARED_RESOURCES_DIR_KEY, "src/test/resources/");
   }
 
   @After

+ 1 - 0
ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AuthorizationTestModule.java

@@ -38,6 +38,7 @@ public class AuthorizationTestModule extends AbstractModule {
         "target/version");
     properties.setProperty(Configuration.OS_VERSION_KEY,
         "centos5");
+    properties.setProperty(Configuration.SHARED_RESOURCES_DIR_KEY, "src/test/resources/");
     //make ambari detect active configuration
     properties.setProperty(Configuration.LDAP_GROUP_BASE_KEY, "ou=groups,dc=ambari,dc=apache,dc=org");
 

+ 1 - 0
ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AuthorizationTestModuleForLdapDNWithSpace.java

@@ -34,6 +34,7 @@ public class AuthorizationTestModuleForLdapDNWithSpace extends AbstractModule {
         "target/version");
     properties.setProperty(Configuration.OS_VERSION_KEY,
         "centos5");
+    properties.setProperty(Configuration.SHARED_RESOURCES_DIR_KEY, "src/test/resources/");
     //make ambari detect active configuration
     properties.setProperty(Configuration.LDAP_BASE_DN_KEY, "dc=ambari,dc=the apache,dc=org");
     properties.setProperty(Configuration.LDAP_GROUP_BASE_KEY, "ou=the groups,dc=ambari,dc=the apache,dc=org");

+ 1 - 0
ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeTest.java

@@ -68,6 +68,7 @@ public class UpgradeTest {
       "target/version");
     properties.setProperty(Configuration.OS_VERSION_KEY,
       "centos5");
+    properties.setProperty(Configuration.SHARED_RESOURCES_DIR_KEY, "src/test/resources/");
   }
 
   @Test

+ 3 - 8
ambari-server/src/test/python/TestOSCheck.py

@@ -27,7 +27,7 @@ import sys
 from unittest import TestCase
 from mock.mock import patch
 
-from ambari_commons import OSCheck, OSConst
+from ambari_commons import OSCheck
 import os_check_type
 
 utils = __import__('ambari_server.utils').utils
@@ -87,7 +87,6 @@ class TestOSCheck(TestCase):
     result = OSCheck.get_os_type()
     self.assertEquals(result, 'redhat')
 
-
   @patch("platform.linux_distribution")
   @patch("os.path.exists")
   def test_get_os_family(self, mock_exists, mock_linux_distribution):
@@ -132,7 +131,6 @@ class TestOSCheck(TestCase):
       self.assertEquals("Cannot detect os type. Exiting...", str(e))
       pass
 
-
   @patch("platform.linux_distribution")
   def test_get_os_version(self, mock_linux_distribution):
 
@@ -151,7 +149,6 @@ class TestOSCheck(TestCase):
       self.assertEquals("Cannot detect os version. Exiting...", str(e))
       pass
 
-
   @patch("platform.linux_distribution")
   def test_get_os_major_version(self, mock_linux_distribution):
 
@@ -165,7 +162,6 @@ class TestOSCheck(TestCase):
     result = OSCheck.get_os_major_version()
     self.assertEquals(result, '11')
 
-
   @patch("platform.linux_distribution")
   def test_get_os_release_name(self, mock_linux_distribution):
 
@@ -184,7 +180,6 @@ class TestOSCheck(TestCase):
       self.assertEquals("Cannot detect os release name. Exiting...", str(e))
       pass
 
-
   @patch.object(ambari_server, "get_conf_dir")
   def test_update_ambari_properties_os(self, get_conf_dir_mock):
 
@@ -219,7 +214,7 @@ class TestOSCheck(TestCase):
 
     count = 0
     for line in ambari_properties_content:
-      if ( not line.startswith('#') ):
+      if (not line.startswith('#')):
         count += 1
         if (line == "server.os_type=old_sys_os6\n"):
           self.fail("line=" + line)
@@ -255,7 +250,7 @@ class TestOSCheck(TestCase):
       self.fail("Must fail because os's not compatible.")
     except Exception as e:
       self.assertEquals(
-        "Local OS is not compatible with cluster primary OS. Please perform manual bootstrap on this host.",
+        "Local OS is not compatible with cluster primary OS family. Please perform manual bootstrap on this host.",
         str(e))
       pass
 

+ 44 - 0
ambari-server/src/test/resources/os_family.json

@@ -0,0 +1,44 @@
+{
+  "redhat": {
+    "distro": [
+      "redhat",
+      "fedora",
+      "centos",
+      "oraclelinux",
+      "ascendos",
+      "amazon",
+      "xenserver",
+      "oel",
+      "ovs",
+      "cloudlinux",
+      "slc",
+      "scientific",
+      "psbm",
+      "centos linux"
+    ],
+    "versions": [
+      5,
+      6
+    ]
+  },
+  "ubuntu": {
+    "distro": [
+      "ubuntu",
+      "debian"
+    ],
+    "versions": [
+      12
+    ]
+  },
+  "suse": {
+    "distro": [
+      "sles",
+      "sled",
+      "opensuse",
+      "suse"
+    ],
+    "versions": [
+      11
+    ]
+  }
+}

+ 2 - 2
ambari-server/src/test/resources/stacks/HDP/0.1/repos/repoinfo.xml

@@ -16,7 +16,7 @@
    limitations under the License.
 -->
 <reposinfo>
-  <os type="centos6, redhat6">
+  <os family="centos6, redhat6">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP-1.1.1.16/repos/centos6</baseurl>
       <repoid>HDP-1.1.1.16</repoid>
@@ -35,7 +35,7 @@
       <mirrorslist><![CDATA[https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch]]></mirrorslist>
     </repo>
   </os>
-  <os type="centos5, redhat5">
+  <os family="centos5, redhat5">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP-1.1.1.16/repos/centos5</baseurl>
       <repoid>HDP-1.1.1.16</repoid>

+ 2 - 2
ambari-server/src/test/resources/stacks/HDP/0.2/repos/repoinfo.xml

@@ -16,7 +16,7 @@
    limitations under the License.
 -->
 <reposinfo>
-  <os type="redhat6">
+  <os family="redhat6">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP-1.1.1.16/repos/centos6</baseurl>
       <repoid>HDP-1.1.1.16</repoid>
@@ -35,7 +35,7 @@
       <mirrorslist><![CDATA[https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch]]></mirrorslist>
     </repo>
   </os>
-  <os type="centos5">
+  <os family="centos5">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP-1.1.1.16/repos/centos5</baseurl>
       <repoid>HDP-1.1.1.16</repoid>

+ 8 - 8
ambari-server/src/test/resources/stacks/HDP/1.2.0/repos/repoinfo.xml

@@ -16,7 +16,7 @@
    limitations under the License.
 -->
 <reposinfo>
-  <os type="centos6">
+  <os family="centos6">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP-1.2.0/repos/centos6</baseurl>
       <repoid>HDP-1.2.0</repoid>
@@ -29,7 +29,7 @@
       <mirrorslist><![CDATA[http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch]]></mirrorslist>
     </repo>
   </os>
-  <os type="centos5">
+  <os family="centos5">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP-1.2.0/repos/centos5</baseurl>
       <repoid>HDP-1.2.0</repoid>
@@ -42,7 +42,7 @@
       <mirrorslist><![CDATA[http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch]]></mirrorslist>
     </repo>
   </os>
-  <os type="redhat6">
+  <os family="redhat6">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP-1.2.0/repos/centos6</baseurl>
       <repoid>HDP-1.2.0</repoid>
@@ -55,7 +55,7 @@
       <mirrorslist><![CDATA[http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch]]></mirrorslist>
     </repo>
   </os>
-  <os type="redhat5">
+  <os family="redhat5">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP-1.2.0/repos/centos5</baseurl>
       <repoid>HDP-1.2.0</repoid>
@@ -68,7 +68,7 @@
       <mirrorslist><![CDATA[http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch]]></mirrorslist>
     </repo>
   </os>
-  <os type="oraclelinux6">
+  <os family="oraclelinux6">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP-1.2.0/repos/centos6</baseurl>
       <repoid>HDP-1.2.0</repoid>
@@ -81,7 +81,7 @@
       <mirrorslist><![CDATA[http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch]]></mirrorslist>
     </repo>
   </os>
-  <os type="oraclelinux5">
+  <os family="oraclelinux5">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP-1.2.0/repos/centos5</baseurl>
       <repoid>HDP-1.2.0</repoid>
@@ -94,7 +94,7 @@
       <mirrorslist><![CDATA[http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch]]></mirrorslist>
     </repo>
   </os>
-  <os type="suse11">
+  <os family="suse11">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP-1.2.0/repos/suse11</baseurl>
       <repoid>HDP-1.2.0</repoid>
@@ -107,7 +107,7 @@
       <mirrorslist></mirrorslist>
     </repo>
   </os>
-    <os type="sles11">
+    <os family="sles11">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP-1.2.0/repos/suse11</baseurl>
       <repoid>HDP-1.2.0</repoid>

+ 8 - 8
ambari-server/src/test/resources/stacks/HDP/1.3.0/repos/repoinfo.xml

@@ -16,7 +16,7 @@
    limitations under the License.
 -->
 <reposinfo>
-  <os type="centos6">
+  <os family="centos6">
     <repo>
       <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP-1.3.0/repos/centos6</baseurl>
       <repoid>HDP-1.3.0</repoid>
@@ -29,7 +29,7 @@
       <mirrorslist><![CDATA[http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch]]></mirrorslist>
     </repo>
   </os>
-  <os type="centos5">
+  <os family="centos5">
     <repo>
       <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP-1.3.0/repos/centos5</baseurl>
       <repoid>HDP-1.3.0</repoid>
@@ -42,7 +42,7 @@
       <mirrorslist><![CDATA[http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch]]></mirrorslist>
     </repo>
   </os>
-  <os type="redhat6">
+  <os family="redhat6">
     <repo>
       <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP-1.3.0/repos/centos6</baseurl>
       <repoid>HDP-1.3.0</repoid>
@@ -55,7 +55,7 @@
       <mirrorslist><![CDATA[http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch]]></mirrorslist>
     </repo>
   </os>
-  <os type="redhat5">
+  <os family="redhat5">
     <repo>
       <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP-1.3.0/repos/centos5</baseurl>
       <repoid>HDP-1.3.0</repoid>
@@ -68,7 +68,7 @@
       <mirrorslist><![CDATA[http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch]]></mirrorslist>
     </repo>
   </os>
-  <os type="oraclelinux6">
+  <os family="oraclelinux6">
     <repo>
       <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP-1.3.0/repos/centos6</baseurl>
       <repoid>HDP-1.3.0</repoid>
@@ -81,7 +81,7 @@
       <mirrorslist><![CDATA[http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch]]></mirrorslist>
     </repo>
   </os>
-  <os type="oraclelinux5">
+  <os family="oraclelinux5">
     <repo>
       <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP-1.3.0/repos/centos5</baseurl>
       <repoid>HDP-1.3.0</repoid>
@@ -94,14 +94,14 @@
       <mirrorslist><![CDATA[http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch]]></mirrorslist>
     </repo>
   </os>
-  <os type="suse11">
+  <os family="suse11">
     <repo>
       <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP-1.3.0/repos/suse11</baseurl>
       <repoid>HDP-1.3.0</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-    <os type="sles11">
+    <os family="sles11">
     <repo>
       <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP-1.3.0/repos/suse11</baseurl>
       <repoid>HDP-1.3.0</repoid>

+ 6 - 6
ambari-server/src/test/resources/stacks/HDP/1.3.1/repos/repoinfo.xml

@@ -16,7 +16,7 @@
    limitations under the License.
 -->
 <reposinfo>
-  <os type="centos6">
+  <os family="centos6">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos6/1.x/updates/1.2.1</baseurl>
       <repoid>HDP-1.2.1</repoid>
@@ -29,7 +29,7 @@
       <mirrorslist><![CDATA[http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch]]></mirrorslist>
     </repo>
   </os>
-  <os type="centos5">
+  <os family="centos5">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos5/1.x/updates/1.2.1</baseurl>
       <repoid>HDP-1.2.1</repoid>
@@ -42,7 +42,7 @@
       <mirrorslist><![CDATA[http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch]]></mirrorslist>
     </repo>
   </os>
-  <os type="redhat6">
+  <os family="redhat6">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos6/1.x/updates/1.2.1</baseurl>
       <repoid>HDP-1.2.1</repoid>
@@ -55,7 +55,7 @@
       <mirrorslist><![CDATA[http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch]]></mirrorslist>
     </repo>
   </os>
-  <os type="redhat5">
+  <os family="redhat5">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos5/1.x/updates/1.2.1</baseurl>
       <repoid>HDP-1.2.1</repoid>
@@ -68,7 +68,7 @@
       <mirrorslist><![CDATA[http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch]]></mirrorslist>
     </repo>
   </os>
-  <os type="suse11">
+  <os family="suse11">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/suse11/1.x/updates/1.2.1</baseurl>
       <repoid>HDP-1.2.1</repoid>
@@ -81,7 +81,7 @@
       <mirrorslist></mirrorslist>
     </repo>
   </os>
-    <os type="sles11">
+    <os family="sles11">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/suse11/1.x/updates/1.2.1</baseurl>
       <repoid>HDP-1.2.1</repoid>

+ 6 - 6
ambari-server/src/test/resources/stacks/HDP/2.0.1/repos/repoinfo.xml

@@ -16,28 +16,28 @@
    limitations under the License.
 -->
 <reposinfo>
-  <os type="centos6">
+  <os family="centos6">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP-2.0.0.2/repos/centos6</baseurl>
       <repoid>HDP-2.0.1</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="centos5">
+  <os family="centos5">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP-2.0.0.2/repos/centos5</baseurl>
       <repoid>HDP-2.0.1</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="redhat6">
+  <os family="redhat6">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP-2.0.0.2/repos/centos6</baseurl>
       <repoid>HDP-2.0.1</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="redhat5">
+  <os family="redhat5">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP-2.0.0.2/repos/centos5</baseurl>
       <repoid>HDP-2.0.1</repoid>
@@ -45,7 +45,7 @@
     </repo>
   </os>
 <!--
-  <os type="suse11">
+  <os family="suse11">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP-2.0.1/repos/suse11</baseurl>
       <repoid>HDP-2.0.1</repoid>
@@ -58,7 +58,7 @@
       <mirrorslist></mirrorslist>
     </repo>
   </os>
-    <os type="sles11">
+    <os family="sles11">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP-2.0.1/repos/suse11</baseurl>
       <repoid>HDP-2.0.1</repoid>

+ 6 - 6
ambari-server/src/test/resources/stacks/HDP/2.0.5/repos/repoinfo.xml

@@ -16,42 +16,42 @@
    limitations under the License.
 -->
 <reposinfo>
-  <os type="centos6">
+  <os family="centos6">
     <repo>
       <baseurl>http://dev.hortonworks.com.s3.amazonaws.com/HDP-2.0.5.0/repos/centos6</baseurl>
       <repoid>HDP-2.0.5</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="centos5">
+  <os family="centos5">
     <repo>
       <baseurl>http://dev.hortonworks.com.s3.amazonaws.com/HDP-2.0.5.0/repos/centos5</baseurl>
       <repoid>HDP-2.0.5</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="redhat6">
+  <os family="redhat6">
     <repo>
       <baseurl>http://dev.hortonworks.com.s3.amazonaws.com/HDP-2.0.5.0/repos/centos6</baseurl>
       <repoid>HDP-2.0.5</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="redhat5">
+  <os family="redhat5">
     <repo>
       <baseurl>http://dev.hortonworks.com.s3.amazonaws.com/HDP-2.0.5.0/repos/centos5</baseurl>
       <repoid>HDP-2.0.5</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="suse11">
+  <os family="suse11">
     <repo>
       <baseurl>http://dev.hortonworks.com.s3.amazonaws.com/HDP-2.0.5.0/repos/suse11</baseurl>
       <repoid>HDP-2.0.5</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="sles11">
+  <os family="sles11">
     <repo>
       <baseurl>http://dev.hortonworks.com.s3.amazonaws.com/HDP-2.0.5.0/repos/suse11</baseurl>
       <repoid>HDP-2.0.5</repoid>

+ 6 - 6
ambari-server/src/test/resources/stacks/HDP/2.0.6/repos/repoinfo.xml

@@ -16,42 +16,42 @@
    limitations under the License.
 -->
 <reposinfo>
-  <os type="centos6">
+  <os family="centos6">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.0.6</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="centos5">
+  <os family="centos5">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos5/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.0.6</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="redhat6">
+  <os family="redhat6">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.0.6</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="redhat5">
+  <os family="redhat5">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos5/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.0.6</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="suse11">
+  <os family="suse11">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/suse11/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.0.6</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="sles11">
+  <os family="sles11">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/suse11/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.0.6</repoid>

+ 6 - 6
ambari-server/src/test/resources/stacks/HDP/2.0.7/repos/repoinfo.xml

@@ -16,42 +16,42 @@
    limitations under the License.
 -->
 <reposinfo>
-  <os type="centos6">
+  <os family="centos6">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.0.7</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="centos5">
+  <os family="centos5">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos5/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.0.7</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="redhat6">
+  <os family="redhat6">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.0.7</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="redhat5">
+  <os family="redhat5">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos5/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.0.7</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="suse11">
+  <os family="suse11">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/suse11/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.0.7</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="sles11">
+  <os family="sles11">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/suse11/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.0.7</repoid>

+ 6 - 6
ambari-server/src/test/resources/stacks/HDP/2.0.8/repos/repoinfo.xml

@@ -16,42 +16,42 @@
    limitations under the License.
 -->
 <reposinfo>
-  <os type="centos6">
+  <os family="centos6">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.0.8</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="centos5">
+  <os family="centos5">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos5/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.0.8</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="redhat6">
+  <os family="redhat6">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.0.8</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="redhat5">
+  <os family="redhat5">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos5/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.0.8</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="suse11">
+  <os family="suse11">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/suse11/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.0.8</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="sles11">
+  <os family="sles11">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/suse11/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.0.8</repoid>

+ 6 - 6
ambari-server/src/test/resources/stacks/HDP/2.1.1/repos/repoinfo.xml

@@ -17,42 +17,42 @@
 -->
 <reposinfo>
   <latest>./hdp.json</latest>
-  <os type="centos6">
+  <os family="centos6">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.1.1</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="centos5">
+  <os family="centos5">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos5/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.1.1</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="redhat6">
+  <os family="redhat6">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.1.1</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="redhat5">
+  <os family="redhat5">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos5/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.1.1</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="suse11">
+  <os family="suse11">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/suse11/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.1.1</repoid>
       <reponame>HDP</reponame>
     </repo>
   </os>
-  <os type="sles11">
+  <os family="sles11">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/suse11/2.x/updates/2.0.6.0</baseurl>
       <repoid>HDP-2.1.1</repoid>

+ 1 - 1
contrib/ambari-scom/metrics-sink/pom.xml

@@ -20,7 +20,7 @@
         <groupId>org.apache.ambari</groupId>
         <artifactId>ambari-scom-project</artifactId>
         <version>1.0.0</version>
-    </parent>  
+    </parent>
     <modelVersion>4.0.0</modelVersion>
     <artifactId>metrics-sink</artifactId>
     <packaging>jar</packaging>