ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject ambari git commit: AMBARI-22147 Move stacks/HDP/3.0/kerberos.json to stacks/kerberos.json (dsen)
Date Fri, 06 Oct 2017 16:39:33 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 01b79aae5 -> 2fb4649e2


AMBARI-22147 Move stacks/HDP/3.0/kerberos.json to stacks/kerberos.json (dsen)


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

Branch: refs/heads/trunk
Commit: 2fb4649e2a9381b98c4867ac4a550f7c3ff7ed23
Parents: 01b79aa
Author: Dmytro Sen <dsen@apache.org>
Authored: Fri Oct 6 19:39:24 2017 +0300
Committer: Dmytro Sen <dsen@apache.org>
Committed: Fri Oct 6 19:39:24 2017 +0300

----------------------------------------------------------------------
 .../server/api/services/AmbariMetaInfo.java     | 54 +++++++------
 .../server/controller/StackVersionResponse.java | 29 -------
 .../internal/StackArtifactResourceProvider.java | 17 +----
 .../ambari/server/stack/ServiceDirectory.java   |  3 +-
 .../ambari/server/stack/StackDirectory.java     | 27 -------
 .../apache/ambari/server/stack/StackModule.java |  6 --
 .../apache/ambari/server/state/ServiceInfo.java |  2 +-
 .../apache/ambari/server/state/StackInfo.java   | 23 ------
 ambari-server/src/main/resources/kerberos.json  | 79 ++++++++++++++++++++
 .../resources/stacks/HDP/2.0.6/kerberos.json    | 79 --------------------
 .../main/resources/stacks/HDP/3.0/kerberos.json | 79 --------------------
 .../server/api/services/AmbariMetaInfoTest.java | 19 +++--
 .../ambari/server/stack/StackManagerTest.java   |  8 --
 .../KerberosDescriptorUpdateHelperTest.java     |  1 +
 ambari-server/src/test/resources/kerberos.json  | 42 +++++++++++
 .../resources/stacks/HDP/2.0.8/kerberos.json    | 42 -----------
 16 files changed, 170 insertions(+), 340 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2fb4649e/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
index 425d247..46ee65a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
@@ -21,7 +21,6 @@ package org.apache.ambari.server.api.services;
 import static org.apache.ambari.server.controller.spi.Resource.InternalType.Component;
 import static org.apache.ambari.server.controller.spi.Resource.InternalType.HostComponent;
 import static org.apache.ambari.server.controller.utilities.PropertyHelper.AGGREGATE_FUNCTION_IDENTIFIERS;
-import static org.apache.ambari.server.stack.StackDirectory.WIDGETS_DESCRIPTOR_FILE_NAME;
 
 import java.io.File;
 import java.io.FileReader;
@@ -106,6 +105,17 @@ public class AmbariMetaInfo {
    * Version of XML files with support of custom services and custom commands
    */
   public static final String SCHEMA_VERSION_2 = "2.0";
+
+  /**
+   * The filename for a Kerberos descriptor file at either the stack or service level
+   */
+  public static final String KERBEROS_DESCRIPTOR_FILE_NAME = "kerberos.json";
+
+  /**
+   * The filename for a Widgets descriptor file at either the stack or service level
+   */
+  public static final String WIDGETS_DESCRIPTOR_FILE_NAME = "widgets.json";
+
   private final static Logger LOG = LoggerFactory.getLogger(AmbariMetaInfo.class);
 
 
@@ -128,6 +138,7 @@ public class AmbariMetaInfo {
   private File serverVersionFile;
   private File commonWidgetsDescriptorFile;
   private File customActionRoot;
+  private String commonKerberosDescriptorFileLocation;
   private Map<String, VersionDefinitionXml> versionDefinitions = null;
 
 
@@ -217,6 +228,7 @@ public class AmbariMetaInfo {
 
     customActionRoot = new File(conf.getCustomActionDefinitionPath());
 
+    commonKerberosDescriptorFileLocation = new File(conf.getResourceDirPath(), KERBEROS_DESCRIPTOR_FILE_NAME).getAbsolutePath();
     commonWidgetsDescriptorFile = new File(conf.getResourceDirPath(), WIDGETS_DESCRIPTOR_FILE_NAME);
   }
 
@@ -1257,38 +1269,25 @@ public class AmbariMetaInfo {
   public KerberosDescriptor getKerberosDescriptor(String stackName, String stackVersion,
boolean includePreconfigureData) throws AmbariException {
     StackInfo stackInfo = getStack(stackName, stackVersion);
 
-    KerberosDescriptor kerberosDescriptor = null;
+    KerberosDescriptor kerberosDescriptor = readKerberosDescriptorFromFile(getCommonKerberosDescriptorFileLocation());
 
+    if (kerberosDescriptor == null) {
+      LOG.warn("Couldn't read common Kerberos descriptor with path {%s}", getCommonKerberosDescriptorFileLocation());
+      kerberosDescriptor = new KerberosDescriptor();
+    }
     // Read in the stack-level Kerberos descriptor pre-configuration data
     if (includePreconfigureData) {
-      kerberosDescriptor = readKerberosDescriptorFromFile(stackInfo.getKerberosDescriptorPreConfigurationFileLocation());
+      KerberosDescriptor preConfigureKerberosDescriptor = readKerberosDescriptorFromFile(stackInfo.getKerberosDescriptorPreConfigurationFileLocation());
 
-      if (kerberosDescriptor != null) {
+      if (preConfigureKerberosDescriptor != null) {
         // Ensure the all services to be pre-configured are flagged appropriately.
-        Map<String, KerberosServiceDescriptor> serviceDescriptors = kerberosDescriptor.getServices();
+        Map<String, KerberosServiceDescriptor> serviceDescriptors = preConfigureKerberosDescriptor.getServices();
         if (serviceDescriptors != null) {
           for (KerberosServiceDescriptor serviceDescriptor : serviceDescriptors.values())
{
             serviceDescriptor.setPreconfigure(true);
           }
         }
-      }
-    }
-
-    // Read in the base stack-level Kerberos descriptor.
-    KerberosDescriptor stackKerberosDescriptor = readKerberosDescriptorFromFile(stackInfo.getKerberosDescriptorFileLocation());
-    if (stackKerberosDescriptor == null) {
-      // If kerberosDescriptor is null and stackKerberosDescriptor is null, then ensure
-      // kerberosDescriptor is an empty KerberosDescriptor.
-      if (kerberosDescriptor == null) {
-        kerberosDescriptor = new KerberosDescriptor();
-      }
-    } else {
-      if (kerberosDescriptor == null) {
-        // If kerberosDescriptor is null; then set it to stackKerberosDescriptor.
-        kerberosDescriptor = stackKerberosDescriptor;
-      } else {
-        // If kerberosDescriptor is not null; then update it using stackKerberosDescriptor.
-        kerberosDescriptor.update(stackKerberosDescriptor);
+        kerberosDescriptor.update(preConfigureKerberosDescriptor);
       }
     }
 
@@ -1314,6 +1313,15 @@ public class AmbariMetaInfo {
   }
 
   /**
+   * Gets the path to the common Kerberos descriptor file
+   *
+   * @return a String containing the path to the common Kerberos descriptor file
+   */
+  protected String getCommonKerberosDescriptorFileLocation() {
+    return commonKerberosDescriptorFileLocation;
+  }
+
+  /**
    * Gets the requested service-level Kerberos descriptor(s)
    * <p/>
    * An array of descriptors are returned since the kerberos.json in a service directory
may contain

http://git-wip-us.apache.org/repos/asf/ambari/blob/2fb4649e/ambari-server/src/main/java/org/apache/ambari/server/controller/StackVersionResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackVersionResponse.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackVersionResponse.java
index 8fa0bf9..38b32d2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackVersionResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackVersionResponse.java
@@ -42,13 +42,6 @@ public class StackVersionResponse implements Validable{
   private Map<String, Map<String, Map<String, String>>> configTypes;
 
   /**
-   * A File pointing to the stack-level Kerberos descriptor file
-   *
-   * This may be null if a relevant file is not available.
-   */
-  private File stackKerberosDescriptorFile;
-
-  /**
    * A Collection of Files pointing to the service-level Kerberos descriptor files
    *
    * This may be null or empty if no relevant files are available.
@@ -59,7 +52,6 @@ public class StackVersionResponse implements Validable{
   public StackVersionResponse(String stackVersion, String minUpgradeVersion,
                               boolean active, String parentVersion,
                               Map<String, Map<String, Map<String, String>>>
configTypes,
-                              File stackKerberosDescriptorFile,
                               Collection<File> serviceKerberosDescriptorFiles,
                               Set<String> upgradePacks, boolean valid, Collection<String>
errorSet, String minJdk, String maxJdk) {
     setStackVersion(stackVersion);
@@ -67,7 +59,6 @@ public class StackVersionResponse implements Validable{
     setActive(active);
     setParentVersion(parentVersion);
     setConfigTypes(configTypes);
-    setKerberosDescriptorFile(stackKerberosDescriptorFile);
     setServiceKerberosDescriptorFiles(serviceKerberosDescriptorFiles);
     setUpgradePacks(upgradePacks);
     setValid(valid);
@@ -176,26 +167,6 @@ public class StackVersionResponse implements Validable{
   }
 
   /**
-   * Gets a File pointing to the stack-level Kerberos descriptor
-   *
-   * @return a File pointing to the stack-level Kerberos descriptor, or null if no relevant
file is
-   * available
-   */
-  @ApiModelProperty(hidden = true)
-  public File getStackKerberosDescriptorFile() {
-    return stackKerberosDescriptorFile;
-  }
-
-  /**
-   * Sets the stack-level Kerberos descriptor File
-   *
-   * @param stackKerberosDescriptorFile a File pointing to the stack-level Kerberos descriptor
-   */
-  public void setKerberosDescriptorFile(File stackKerberosDescriptorFile) {
-    this.stackKerberosDescriptorFile = stackKerberosDescriptorFile;
-  }
-
-  /**
    * Gets the Collection of Files pointing to the stack-specific service-level Kerberos descriptor
    * files
    *

http://git-wip-us.apache.org/repos/asf/ambari/blob/2fb4649e/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackArtifactResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackArtifactResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackArtifactResourceProvider.java
index a7f7710..6bb421b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackArtifactResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackArtifactResourceProvider.java
@@ -483,7 +483,7 @@ public class StackArtifactResourceProvider extends AbstractControllerResourcePro
   private Map<String, Object> buildStackDescriptor(String stackName, String stackVersion)
       throws NoSuchParentResourceException, IOException {
 
-    KerberosDescriptor kerberosDescriptor = null;
+    KerberosDescriptor kerberosDescriptor = new KerberosDescriptor();
 
     AmbariManagementController controller = getManagementController();
     StackInfo stackInfo;
@@ -496,19 +496,8 @@ public class StackArtifactResourceProvider extends AbstractControllerResourcePro
 
     Collection<KerberosServiceDescriptor> serviceDescriptors = getServiceDescriptors(stackInfo);
 
-    String kerberosFileLocation = stackInfo.getKerberosDescriptorFileLocation();
-    if (kerberosFileLocation != null) {
-      kerberosDescriptor = kerberosDescriptorFactory.createInstance(new File(kerberosFileLocation));
-    } else if (! serviceDescriptors.isEmpty()) {
-      // service descriptors present with no stack descriptor,
-      // create an empty stack descriptor to hold services
-      kerberosDescriptor = new KerberosDescriptor();
-    }
-
-    if (kerberosDescriptor != null) {
-      for (KerberosServiceDescriptor descriptor : serviceDescriptors) {
-        kerberosDescriptor.putService(descriptor);
-      }
+    if (serviceDescriptors != null) {
+      serviceDescriptors.forEach(kerberosDescriptor::putService);
       return kerberosDescriptor.toMap();
     } else {
       return null;

http://git-wip-us.apache.org/repos/asf/ambari/blob/2fb4649e/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceDirectory.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceDirectory.java
b/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceDirectory.java
index ae59b3f..119163e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceDirectory.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceDirectory.java
@@ -24,6 +24,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.state.ServiceInfo;
 import org.apache.ambari.server.state.stack.ServiceMetainfoXml;
 import org.apache.ambari.server.state.stack.StackRoleCommandOrder;
@@ -259,7 +260,7 @@ public abstract class ServiceDirectory extends StackDefinitionDirectory
{
     File af = new File(directory, StackDirectory.SERVICE_ALERT_FILE_NAME);
     alertsFile = af.exists() ? af : null;
 
-    File kdf = new File(directory, StackDirectory.KERBEROS_DESCRIPTOR_FILE_NAME);
+    File kdf = new File(directory, AmbariMetaInfo.KERBEROS_DESCRIPTOR_FILE_NAME);
     kerberosDescriptorFile = kdf.exists() ? kdf : null;
 
     File rco = new File(directory, StackDirectory.RCO_FILE_NAME);

http://git-wip-us.apache.org/repos/asf/ambari/blob/2fb4649e/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
index e3c586b..daf8e7c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
@@ -57,14 +57,6 @@ public class StackDirectory extends StackDefinitionDirectory {
   public static final String SERVICE_ALERT_FILE_NAME = "alerts.json";
   public static final String SERVICE_ADVISOR_FILE_NAME = "service_advisor.py";
   /**
-   * The filename for a Kerberos descriptor file at either the stack or service level
-   */
-  public static final String KERBEROS_DESCRIPTOR_FILE_NAME = "kerberos.json";
-  /**
-   * The filename for a Widgets descriptor file at either the stack or service level
-   */
-  public static final String WIDGETS_DESCRIPTOR_FILE_NAME = "widgets.json";
-  /**
    * The filename for a Kerberos descriptor preconfigure file at either the stack or service
level
    */
   public static final String KERBEROS_DESCRIPTOR_PRECONFIGURE_FILE_NAME = "kerberos_preconfigure.json";
@@ -84,11 +76,6 @@ public class StackDirectory extends StackDefinitionDirectory {
   private String rcoFilePath;
 
   /**
-   * kerberos descriptor file path
-   */
-  private String kerberosDescriptorFilePath;
-
-  /**
    * kerberos descriptor (preconfigure) file path
    */
   private String kerberosDescriptorPreconfigureFilePath;
@@ -210,15 +197,6 @@ public class StackDirectory extends StackDefinitionDirectory {
   }
 
   /**
-   * Obtain the path to the (stack-level) Kerberos descriptor file
-   *
-   * @return the path to the (stack-level) Kerberos descriptor file
-   */
-  public String getKerberosDescriptorFilePath() {
-    return kerberosDescriptorFilePath;
-  }
-
-  /**
    * Obtain the path to the (stack-level) Kerberos descriptor pre-configuration file
    *
    * @return the path to the (stack-level) Kerberos descriptor pre-configuration file
@@ -300,11 +278,6 @@ public class StackDirectory extends StackDefinitionDirectory {
       rcoFilePath = getAbsolutePath() + File.separator + RCO_FILE_NAME;
     }
 
-    if (subDirs.contains(KERBEROS_DESCRIPTOR_FILE_NAME)) {
-      // kerberosDescriptorFilePath is expected to be absolute
-      kerberosDescriptorFilePath = getAbsolutePath() + File.separator + KERBEROS_DESCRIPTOR_FILE_NAME;
-    }
-
     if (subDirs.contains(KERBEROS_DESCRIPTOR_PRECONFIGURE_FILE_NAME)) {
       // kerberosDescriptorPreconfigureFilePath is expected to be absolute
       kerberosDescriptorPreconfigureFilePath = getAbsolutePath() + File.separator + KERBEROS_DESCRIPTOR_PRECONFIGURE_FILE_NAME;

http://git-wip-us.apache.org/repos/asf/ambari/blob/2fb4649e/ambari-server/src/main/java/org/apache/ambari/server/stack/StackModule.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackModule.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackModule.java
index 71235f3..e88bbf2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackModule.java
@@ -284,11 +284,6 @@ public class StackModule extends BaseModule<StackModule, StackInfo>
implements V
     mergeConfigurations(parentStack, allStacks, commonServices, extensions);
     mergeRoleCommandOrder(parentStack);
 
-    // grab stack level kerberos.json from parent stack
-    if (stackInfo.getKerberosDescriptorFileLocation() == null) {
-      stackInfo.setKerberosDescriptorFileLocation(parentStack.getModuleInfo().getKerberosDescriptorFileLocation());
-    }
-
     // grab stack level kerberos_preconfigure.json from parent stack
     if (stackInfo.getKerberosDescriptorPreConfigurationFileLocation() == null) {
       stackInfo.setKerberosDescriptorPreConfigurationFileLocation(parentStack.getModuleInfo().getKerberosDescriptorPreConfigurationFileLocation());
@@ -567,7 +562,6 @@ public class StackModule extends BaseModule<StackModule, StackInfo>
implements V
       stackInfo.setActive(smx.getVersion().isActive());
       stackInfo.setParentStackVersion(smx.getExtends());
       stackInfo.setRcoFileLocation(stackDirectory.getRcoFilePath());
-      stackInfo.setKerberosDescriptorFileLocation(stackDirectory.getKerberosDescriptorFilePath());
       stackInfo.setKerberosDescriptorPreConfigurationFileLocation(stackDirectory.getKerberosDescriptorPreconfigureFilePath());
       stackInfo.setUpgradesFolder(stackDirectory.getUpgradesDir());
       stackInfo.setUpgradePacks(stackDirectory.getUpgradePacks());

http://git-wip-us.apache.org/repos/asf/ambari/blob/2fb4649e/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
index ef18bd9..8fe6583 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
@@ -134,7 +134,7 @@ public class ServiceInfo implements Validable{
   private String parent;
 
   @XmlElement(name = "widgetsFileName")
-  private String widgetsFileName = StackDirectory.WIDGETS_DESCRIPTOR_FILE_NAME;
+  private String widgetsFileName = AmbariMetaInfo.WIDGETS_DESCRIPTOR_FILE_NAME;
 
   @XmlElement(name = "metricsFileName")
   private String metricsFileName = StackDirectory.SERVICE_METRIC_FILE_NAME;

http://git-wip-us.apache.org/repos/asf/ambari/blob/2fb4649e/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java
index 3efc997..c32e907 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java
@@ -325,9 +325,6 @@ public class StackInfo implements Comparable<StackInfo>, Validable
{
 
   public StackVersionResponse convertToResponse() {
 
-    // Get the stack-level Kerberos descriptor file path
-    String stackDescriptorFileFilePath = getKerberosDescriptorFileLocation();
-
     // Collect the services' Kerberos descriptor files
     Collection<ServiceInfo> serviceInfos = getServices();
     // The collection of service descriptor files. A Set is being used because some Kerberos
descriptor
@@ -345,7 +342,6 @@ public class StackInfo implements Comparable<StackInfo>, Validable
{
 
     return new StackVersionResponse(getVersion(), getMinUpgradeVersion(),
         isActive(), getParentStackVersion(), getConfigTypeAttributes(),
-        (stackDescriptorFileFilePath == null) ? null : new File(stackDescriptorFileFilePath),
         serviceDescriptorFiles,
         null == upgradePacks ? Collections.emptySet() : upgradePacks.keySet(),
         isValid(), getErrors(), getMinJdk(), getMaxJdk());
@@ -392,25 +388,6 @@ public class StackInfo implements Comparable<StackInfo>, Validable
{
   }
 
   /**
-   * Gets the path to the stack-level Kerberos descriptor file
-   *
-   * @return a String containing the path to the stack-level Kerberos descriptor file
-   */
-  public String getKerberosDescriptorFileLocation() {
-    return kerberosDescriptorFileLocation;
-  }
-
-  /**
-   * Sets the path to the stack-level Kerberos descriptor file
-   *
-   * @param kerberosDescriptorFileLocation a String containing the path to the stack-level
Kerberos
-   *                                       descriptor file
-   */
-  public void setKerberosDescriptorFileLocation(String kerberosDescriptorFileLocation) {
-    this.kerberosDescriptorFileLocation = kerberosDescriptorFileLocation;
-  }
-
-  /**
    * Gets the path to the stack-level Kerberos descriptor pre-configuration file
    *
    * @return a String containing the path to the stack-level Kerberos descriptor pre-configuration
file

http://git-wip-us.apache.org/repos/asf/ambari/blob/2fb4649e/ambari-server/src/main/resources/kerberos.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/kerberos.json b/ambari-server/src/main/resources/kerberos.json
new file mode 100644
index 0000000..3787db1
--- /dev/null
+++ b/ambari-server/src/main/resources/kerberos.json
@@ -0,0 +1,79 @@
+{
+  "properties": {
+    "realm": "${kerberos-env/realm}",
+    "keytab_dir": "/etc/security/keytabs",
+    "additional_realms": "",
+    "principal_suffix": "-${cluster_name|toLower()}"
+  },
+  "identities": [
+    {
+      "name": "spnego",
+      "principal": {
+        "value": "HTTP/_HOST@${realm}",
+        "type": "service"
+      },
+      "keytab": {
+        "file": "${keytab_dir}/spnego.service.keytab",
+        "owner": {
+          "name": "root",
+          "access": "r"
+        },
+        "group": {
+          "name": "${cluster-env/user_group}",
+          "access": "r"
+        }
+      }
+    },
+    {
+      "name": "smokeuser",
+      "principal": {
+        "value": "${cluster-env/smokeuser}${principal_suffix}@${realm}",
+        "type": "user",
+        "configuration": "cluster-env/smokeuser_principal_name",
+        "local_username": "${cluster-env/smokeuser}"
+      },
+      "keytab": {
+        "file": "${keytab_dir}/smokeuser.headless.keytab",
+        "owner": {
+          "name": "${cluster-env/smokeuser}",
+          "access": "r"
+        },
+        "group": {
+          "name": "${cluster-env/user_group}",
+          "access": "r"
+        },
+        "configuration": "cluster-env/smokeuser_keytab"
+      }
+    }
+  ],
+  "services": [
+    {
+      "name": "AMBARI",
+      "components": [
+        {
+          "name": "AMBARI_SERVER",
+          "identities": [
+            {
+              "name": "ambari-server",
+              "principal": {
+                "value": "ambari-server${principal_suffix}@${realm}",
+                "type": "user",
+                "configuration": "cluster-env/ambari_principal_name"
+              },
+              "keytab": {
+                "file": "${keytab_dir}/ambari.server.keytab",
+                "owner": {
+                  "access": "r"
+                }
+              }
+            },
+            {
+              "name" : "ambari-server_spnego",
+              "reference" : "/spnego"
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/2fb4649e/ambari-server/src/main/resources/stacks/HDP/2.0.6/kerberos.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/kerberos.json b/ambari-server/src/main/resources/stacks/HDP/2.0.6/kerberos.json
deleted file mode 100644
index 3787db1..0000000
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/kerberos.json
+++ /dev/null
@@ -1,79 +0,0 @@
-{
-  "properties": {
-    "realm": "${kerberos-env/realm}",
-    "keytab_dir": "/etc/security/keytabs",
-    "additional_realms": "",
-    "principal_suffix": "-${cluster_name|toLower()}"
-  },
-  "identities": [
-    {
-      "name": "spnego",
-      "principal": {
-        "value": "HTTP/_HOST@${realm}",
-        "type": "service"
-      },
-      "keytab": {
-        "file": "${keytab_dir}/spnego.service.keytab",
-        "owner": {
-          "name": "root",
-          "access": "r"
-        },
-        "group": {
-          "name": "${cluster-env/user_group}",
-          "access": "r"
-        }
-      }
-    },
-    {
-      "name": "smokeuser",
-      "principal": {
-        "value": "${cluster-env/smokeuser}${principal_suffix}@${realm}",
-        "type": "user",
-        "configuration": "cluster-env/smokeuser_principal_name",
-        "local_username": "${cluster-env/smokeuser}"
-      },
-      "keytab": {
-        "file": "${keytab_dir}/smokeuser.headless.keytab",
-        "owner": {
-          "name": "${cluster-env/smokeuser}",
-          "access": "r"
-        },
-        "group": {
-          "name": "${cluster-env/user_group}",
-          "access": "r"
-        },
-        "configuration": "cluster-env/smokeuser_keytab"
-      }
-    }
-  ],
-  "services": [
-    {
-      "name": "AMBARI",
-      "components": [
-        {
-          "name": "AMBARI_SERVER",
-          "identities": [
-            {
-              "name": "ambari-server",
-              "principal": {
-                "value": "ambari-server${principal_suffix}@${realm}",
-                "type": "user",
-                "configuration": "cluster-env/ambari_principal_name"
-              },
-              "keytab": {
-                "file": "${keytab_dir}/ambari.server.keytab",
-                "owner": {
-                  "access": "r"
-                }
-              }
-            },
-            {
-              "name" : "ambari-server_spnego",
-              "reference" : "/spnego"
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/2fb4649e/ambari-server/src/main/resources/stacks/HDP/3.0/kerberos.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/3.0/kerberos.json b/ambari-server/src/main/resources/stacks/HDP/3.0/kerberos.json
deleted file mode 100644
index 3787db1..0000000
--- a/ambari-server/src/main/resources/stacks/HDP/3.0/kerberos.json
+++ /dev/null
@@ -1,79 +0,0 @@
-{
-  "properties": {
-    "realm": "${kerberos-env/realm}",
-    "keytab_dir": "/etc/security/keytabs",
-    "additional_realms": "",
-    "principal_suffix": "-${cluster_name|toLower()}"
-  },
-  "identities": [
-    {
-      "name": "spnego",
-      "principal": {
-        "value": "HTTP/_HOST@${realm}",
-        "type": "service"
-      },
-      "keytab": {
-        "file": "${keytab_dir}/spnego.service.keytab",
-        "owner": {
-          "name": "root",
-          "access": "r"
-        },
-        "group": {
-          "name": "${cluster-env/user_group}",
-          "access": "r"
-        }
-      }
-    },
-    {
-      "name": "smokeuser",
-      "principal": {
-        "value": "${cluster-env/smokeuser}${principal_suffix}@${realm}",
-        "type": "user",
-        "configuration": "cluster-env/smokeuser_principal_name",
-        "local_username": "${cluster-env/smokeuser}"
-      },
-      "keytab": {
-        "file": "${keytab_dir}/smokeuser.headless.keytab",
-        "owner": {
-          "name": "${cluster-env/smokeuser}",
-          "access": "r"
-        },
-        "group": {
-          "name": "${cluster-env/user_group}",
-          "access": "r"
-        },
-        "configuration": "cluster-env/smokeuser_keytab"
-      }
-    }
-  ],
-  "services": [
-    {
-      "name": "AMBARI",
-      "components": [
-        {
-          "name": "AMBARI_SERVER",
-          "identities": [
-            {
-              "name": "ambari-server",
-              "principal": {
-                "value": "ambari-server${principal_suffix}@${realm}",
-                "type": "user",
-                "configuration": "cluster-env/ambari_principal_name"
-              },
-              "keytab": {
-                "file": "${keytab_dir}/ambari.server.keytab",
-                "owner": {
-                  "access": "r"
-                }
-              }
-            },
-            {
-              "name" : "ambari-server_spnego",
-              "reference" : "/spnego"
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/2fb4649e/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
index 25e8d04..9285526 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
@@ -151,11 +151,12 @@ public class AmbariMetaInfoTest {
   public static void beforeClass() throws Exception {
     File stacks = new File("src/test/resources/stacks");
     File version = new File("src/test/resources/version");
+    File resourcesRoot = new File("src/test/resources/");
     if (System.getProperty("os.name").contains("Windows")) {
       stacks = new File(ClassLoader.getSystemClassLoader().getResource("stacks").getPath());
       version = new File(new File(ClassLoader.getSystemClassLoader().getResource("").getPath()).getParent(),
"version");
     }
-    metaInfo = createAmbariMetaInfo(stacks, version);
+    metaInfo = createAmbariMetaInfo(stacks, version, resourcesRoot);
   }
 
   @AfterClass
@@ -450,7 +451,7 @@ public class AmbariMetaInfoTest {
       f3.createNewFile();
     }
 
-    AmbariMetaInfo ambariMetaInfo = createAmbariMetaInfo(stackRootTmp, version);
+    AmbariMetaInfo ambariMetaInfo = createAmbariMetaInfo(stackRootTmp, version, new File(""));
 
     // Tests the stack is loaded as expected
     getServices();
@@ -737,7 +738,7 @@ public class AmbariMetaInfoTest {
     LOG.info("Stacks file " + stackRoot.getAbsolutePath());
 
 
-    TestAmbariMetaInfo ambariMetaInfo = createAmbariMetaInfo(stackRoot, version);
+    TestAmbariMetaInfo ambariMetaInfo = createAmbariMetaInfo(stackRoot, version, new File(""));
     Assert.assertEquals(1, ambariMetaInfo.getStackManager().getStacks().size());
     Assert.assertEquals(false, ambariMetaInfo.getStackManager().getStack("HDP", "0.1").isValid());
     Assert.assertEquals(2, ambariMetaInfo.getStackManager().getStack("HDP", "0.1").getErrors().size());
@@ -1820,8 +1821,7 @@ public class AmbariMetaInfoTest {
 
   @Test
   public void testReadKerberosDescriptorFromFile() throws AmbariException {
-    StackInfo stackInfo = metaInfo.getStack(STACK_NAME_HDP, "2.0.8");
-    String path = stackInfo.getKerberosDescriptorFileLocation();
+    String path = metaInfo.getCommonKerberosDescriptorFileLocation();
     KerberosDescriptor descriptor = metaInfo.readKerberosDescriptorFromFile(path);
 
     Assert.assertNotNull(descriptor);
@@ -1899,7 +1899,7 @@ public class AmbariMetaInfoTest {
     File widgetsFile = metaInfo.getCommonWidgetsDescriptorFile();
 
     Assert.assertNotNull(widgetsFile);
-    Assert.assertEquals("/var/lib/ambari-server/resources/widgets.json", widgetsFile.getPath());
+    Assert.assertEquals("src/test/resources/widgets.json", widgetsFile.getPath());
   }
 
   private File getStackRootTmp(String buildDir) {
@@ -1937,16 +1937,17 @@ public class AmbariMetaInfoTest {
   private TestAmbariMetaInfo setupTempAmbariMetaInfoExistingDirs(String buildDir) throws
Exception {
     File version = getVersion();
     File stackRootTmp = getStackRootTmp(buildDir);
-    TestAmbariMetaInfo ambariMetaInfo = createAmbariMetaInfo(stackRootTmp, version);
+    TestAmbariMetaInfo ambariMetaInfo = createAmbariMetaInfo(stackRootTmp, version, new File(""));
     return ambariMetaInfo;
   }
 
   private static TestAmbariMetaInfo createAmbariMetaInfo(File stackRoot,
-    File versionFile) throws Exception {
+    File versionFile, File resourcesRoot) throws Exception {
 
     Properties properties = new Properties();
     properties.setProperty(Configuration.METADATA_DIR_PATH.getKey(), stackRoot.getPath());
     properties.setProperty(Configuration.SERVER_VERSION_FILE.getKey(), versionFile.getPath());
+    properties.setProperty(Configuration.RESOURCES_DIR.getKey(), resourcesRoot.getPath());
     Configuration configuration = new Configuration(properties);
 
     TestAmbariMetaInfo metaInfo = new TestAmbariMetaInfo(configuration);
@@ -2056,9 +2057,11 @@ public class AmbariMetaInfoTest {
       Configuration config = createNiceMock(Configuration.class);
       if (System.getProperty("os.name").contains("Windows")) {
         expect(config.getSharedResourcesDirPath()).andReturn(ClassLoader.getSystemClassLoader().getResource("").getPath()).anyTimes();
+        expect(config.getResourceDirPath()).andReturn(ClassLoader.getSystemClassLoader().getResource("").getPath()).anyTimes();
       }
       else {
         expect(config.getSharedResourcesDirPath()).andReturn("./src/test/resources").anyTimes();
+        expect(config.getResourceDirPath()).andReturn("./src/test/resources").anyTimes();
       }
 
       replay(config);

http://git-wip-us.apache.org/repos/asf/ambari/blob/2fb4649e/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
index f53e111..b8f513c 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
@@ -723,14 +723,6 @@ public class StackManagerTest {
 
   }
 
-  @Test
-  public void testInheritKerberosDescriptor() throws Exception {
-    StackInfo stack = stackManager.getStack("HDP", "2.1.1");
-    String stacksFolder = ClassLoader.getSystemClassLoader().getResource("stacks").getPath();
-    assertEquals(new File(stacksFolder, "HDP/2.0.8/kerberos.json").getAbsolutePath(),
-        stack.getKerberosDescriptorFileLocation());
-  }
-
   /**
    * Tests that {@link UpgradePack} and {@link ConfigUpgradePack} instances are correctly
initialized
    * post-unmarshalling.

http://git-wip-us.apache.org/repos/asf/ambari/blob/2fb4649e/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosDescriptorUpdateHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosDescriptorUpdateHelperTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosDescriptorUpdateHelperTest.java
index 293e050..a3d13b1 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosDescriptorUpdateHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosDescriptorUpdateHelperTest.java
@@ -66,6 +66,7 @@ public class KerberosDescriptorUpdateHelperTest extends EasyMockSupport
{
         properties.put("common.services.path", "src/main/resources/common-services");
         properties.put("server.version.file", "target/version");
         properties.put("custom.action.definitions", "/tmp/nofile");
+        properties.put("resources.dir", "src/main/resources");
         Configuration configuration = new Configuration(properties);
 
         install(new FactoryModuleBuilder().build(StackManagerFactory.class));

http://git-wip-us.apache.org/repos/asf/ambari/blob/2fb4649e/ambari-server/src/test/resources/kerberos.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/kerberos.json b/ambari-server/src/test/resources/kerberos.json
new file mode 100644
index 0000000..14eefbf
--- /dev/null
+++ b/ambari-server/src/test/resources/kerberos.json
@@ -0,0 +1,42 @@
+{
+  "properties": {
+    "realm": "${cluster-env/kerberos_domain}",
+    "keytab_dir": "/etc/security/keytabs",
+    "additional_realms": ""
+  },
+  "identities": [
+    {
+      "name": "spnego",
+      "principal": {
+        "value": "HTTP/_HOST@${realm}",
+        "type" : "service"
+      },
+      "keytab": {
+        "file": "${keytab_dir}/spnego.service.keytab",
+        "owner": {
+          "name": "root",
+          "access": "r"
+        },
+        "group": {
+          "name": "${cluster-env/user_group}",
+          "access": "r"
+        }
+      }
+    }
+  ],
+  "auth_to_local_properties" : [
+    "hadoop.security.auth_to_local"
+  ],
+  "configurations": [
+    {
+      "core-site": {
+        "hadoop.security.authentication": "kerberos",
+        "hadoop.rpc.protection": "authentication",
+        "hadoop.security.authorization": "true",
+        "hadoop.security.auth_to_local": "",
+        "hadoop.proxyuser.superuser.hosts": "",
+        "hadoop.proxyuser.superuser.groups": ""
+      }
+    }
+  ]
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/2fb4649e/ambari-server/src/test/resources/stacks/HDP/2.0.8/kerberos.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/2.0.8/kerberos.json b/ambari-server/src/test/resources/stacks/HDP/2.0.8/kerberos.json
deleted file mode 100644
index 14eefbf..0000000
--- a/ambari-server/src/test/resources/stacks/HDP/2.0.8/kerberos.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
-  "properties": {
-    "realm": "${cluster-env/kerberos_domain}",
-    "keytab_dir": "/etc/security/keytabs",
-    "additional_realms": ""
-  },
-  "identities": [
-    {
-      "name": "spnego",
-      "principal": {
-        "value": "HTTP/_HOST@${realm}",
-        "type" : "service"
-      },
-      "keytab": {
-        "file": "${keytab_dir}/spnego.service.keytab",
-        "owner": {
-          "name": "root",
-          "access": "r"
-        },
-        "group": {
-          "name": "${cluster-env/user_group}",
-          "access": "r"
-        }
-      }
-    }
-  ],
-  "auth_to_local_properties" : [
-    "hadoop.security.auth_to_local"
-  ],
-  "configurations": [
-    {
-      "core-site": {
-        "hadoop.security.authentication": "kerberos",
-        "hadoop.rpc.protection": "authentication",
-        "hadoop.security.authorization": "true",
-        "hadoop.security.auth_to_local": "",
-        "hadoop.proxyuser.superuser.hosts": "",
-        "hadoop.proxyuser.superuser.groups": ""
-      }
-    }
-  ]
-}


Mime
View raw message