You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2016/12/22 17:08:05 UTC
[01/26] ambari git commit: AMBARI-19419. Code cleanup: empty blocks
(Attila Doroszlai via ncole)
Repository: ambari
Updated Branches:
refs/heads/branch-dev-patch-upgrade 7a87817b8 -> 480792817
AMBARI-19419. Code cleanup: empty blocks (Attila Doroszlai via ncole)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/749a5b2d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/749a5b2d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/749a5b2d
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 749a5b2dc583a5571b28e2710f0018abe7f12383
Parents: 95e9804
Author: Nate Cole <nc...@hortonworks.com>
Authored: Tue Dec 20 09:54:41 2016 -0500
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Tue Dec 20 09:54:41 2016 -0500
----------------------------------------------------------------------
ambari-server/checkstyle.xml | 8 ++
.../ambari/server/agent/HeartbeatProcessor.java | 1 +
.../api/services/serializers/CsvSerializer.java | 15 +---
.../server/bootstrap/BSHostStatusCollector.java | 12 +--
.../ambari/server/bootstrap/BSRunner.java | 2 +-
.../gsinstaller/ClusterDefinition.java | 9 +-
.../internal/AbstractProviderModule.java | 4 +-
.../CachedRoleCommandOrderProvider.java | 6 +-
.../server/metadata/RoleCommandOrder.java | 3 +-
.../security/encryption/CredentialProvider.java | 13 +--
.../kerberos/IPAKerberosOperationHandler.java | 16 +---
.../kerberos/MITKerberosOperationHandler.java | 5 +-
.../stack/QuickLinksConfigurationModule.java | 4 -
.../apache/ambari/server/stack/ThemeModule.java | 4 -
.../ambari/server/state/ConfigHelper.java | 2 +-
.../apache/ambari/server/state/ServiceInfo.java | 28 +++---
.../server/state/cluster/ClusterImpl.java | 3 +-
.../server/upgrade/SchemaUpgradeHelper.java | 24 +++---
.../apache/ambari/server/utils/Closeables.java | 72 ++++++++++++++++
.../server/view/ViewDirectoryWatcher.java | 8 +-
.../apache/ambari/server/view/ViewRegistry.java | 24 ++----
.../server/view/ViewURLStreamProvider.java | 3 +-
.../ambari/server/utils/CloseablesTest.java | 91 ++++++++++++++++++++
23 files changed, 232 insertions(+), 125 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/749a5b2d/ambari-server/checkstyle.xml
----------------------------------------------------------------------
diff --git a/ambari-server/checkstyle.xml b/ambari-server/checkstyle.xml
index 0c66556..0742284 100644
--- a/ambari-server/checkstyle.xml
+++ b/ambari-server/checkstyle.xml
@@ -28,5 +28,13 @@
</module>
<module name="RedundantImport"/>
<module name="UnusedImports"/>
+
+ <!-- blocks -->
+ <module name="AvoidNestedBlocks">
+ <property name="allowInSwitchCase" value="true"/>
+ </module>
+ <module name="EmptyBlock">
+ <property name="option" value="text"/>
+ </module>
</module>
</module>
http://git-wip-us.apache.org/repos/asf/ambari/blob/749a5b2d/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java
index ed84e45..4fbc161 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java
@@ -371,6 +371,7 @@ public class HeartbeatProcessor extends AbstractService{
Cluster cluster = clusterFsm.getCluster(report.getClusterName());
clusterId = cluster.getClusterId();
} catch (AmbariException e) {
+ // null clusterId reported and handled by the listener (DistributeRepositoriesActionListener)
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/749a5b2d/ambari-server/src/main/java/org/apache/ambari/server/api/services/serializers/CsvSerializer.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/serializers/CsvSerializer.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/serializers/CsvSerializer.java
index 92d8b69..760eecb 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/serializers/CsvSerializer.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/serializers/CsvSerializer.java
@@ -29,6 +29,7 @@ import org.apache.ambari.server.api.services.Result;
import org.apache.ambari.server.api.services.ResultStatus;
import org.apache.ambari.server.api.util.TreeNode;
import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.utils.Closeables;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVPrinter;
@@ -107,12 +108,7 @@ public class CsvSerializer implements ResultSerializer {
//todo: exception handling. Create ResultStatus 500 and call serializeError
throw new RuntimeException("Unable to serialize to csv: " + e, e);
} finally {
- if (csvPrinter != null) {
- try {
- csvPrinter.close();
- } catch (IOException ex) {
- }
- }
+ Closeables.closeSilently(csvPrinter);
}
}
}
@@ -132,12 +128,7 @@ public class CsvSerializer implements ResultSerializer {
//todo: exception handling. Create ResultStatus 500 and call serializeError
throw new RuntimeException("Unable to serialize to csv: " + e, e);
} finally {
- if (csvPrinter != null) {
- try {
- csvPrinter.close();
- } catch (IOException ex) {
- }
- }
+ Closeables.closeSilently(csvPrinter);
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/749a5b2d/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatusCollector.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatusCollector.java b/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatusCollector.java
index 661f284..79f6511 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatusCollector.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatusCollector.java
@@ -25,6 +25,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import org.apache.ambari.server.utils.Closeables;
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -115,13 +116,8 @@ class BSHostStatusCollector {
} catch (IOException e) {
LOG.info("Error reading log file " + log +
". Log file may be have not created yet");
- }
- finally {
- try {
- reader.close();
- }
- catch (Exception e) {
- }
+ } finally {
+ Closeables.closeSilently(reader);
}
status.setLog(logString);
}
@@ -136,7 +132,7 @@ class BSHostStatusCollector {
int reason = -1;
try {
reason = Integer.parseInt(statusCode);
- } catch (Exception e) {
+ } catch (Exception ignored) {
}
switch (reason) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/749a5b2d/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java b/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java
index 6c77dee..3040443 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java
@@ -159,7 +159,7 @@ class BSRunner extends Thread {
try {
process.exitValue();
return true;
- } catch (IllegalThreadStateException e) {}
+ } catch (IllegalThreadStateException ignored) {}
// Check if process has terminated once per second
Thread.sleep(1000);
} while (System.currentTimeMillis() - startTime < timeout);
http://git-wip-us.apache.org/repos/asf/ambari/blob/749a5b2d/ambari-server/src/main/java/org/apache/ambari/server/controller/gsinstaller/ClusterDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/gsinstaller/ClusterDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/gsinstaller/ClusterDefinition.java
index 6f9876a..d183396 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/gsinstaller/ClusterDefinition.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/gsinstaller/ClusterDefinition.java
@@ -28,6 +28,8 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import org.apache.ambari.server.utils.Closeables;
+
/**
* Defines the cluster created by gsInstaller.
*/
@@ -282,12 +284,7 @@ public class ClusterDefinition {
String msg = "Caught exception reading " + CLUSTER_DEFINITION_FILE + ".";
throw new IllegalStateException(msg, e);
} finally {
- if (is != null) {
- try {
- is.close();
- } catch (IOException ex) {
- }
- }
+ Closeables.closeSilently(is);
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/749a5b2d/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
index 5d462c5..6967fee 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
@@ -747,8 +747,8 @@ public abstract class AbstractProviderModule implements ProviderModule,
PropertyHelper.getPropertyId("ServiceComponentInfo", "state"),
jpp,
gpp));
+ break;
}
- break;
case HostComponent: {
// TODO as we fill out stack metric definitions, these can be phased out
PropertyProvider jpp = createJMXPropertyProvider(
@@ -795,8 +795,8 @@ public abstract class AbstractProviderModule implements ProviderModule,
// this follows the current pattern of relying on the management controller
// to instantiate this PropertyProvider
providers.add(managementController.getLoggingSearchPropertyProvider());
+ break;
}
- break;
case RootServiceComponent:
providers.add(new RootServiceComponentPropertyProvider());
break;
http://git-wip-us.apache.org/repos/asf/ambari/blob/749a5b2d/ambari-server/src/main/java/org/apache/ambari/server/metadata/CachedRoleCommandOrderProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/metadata/CachedRoleCommandOrderProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/metadata/CachedRoleCommandOrderProvider.java
index e2b44ca..7cf197b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/metadata/CachedRoleCommandOrderProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/metadata/CachedRoleCommandOrderProvider.java
@@ -73,7 +73,7 @@ public class CachedRoleCommandOrderProvider implements RoleCommandOrderProvider
if (cluster != null && cluster.getService("GLUSTERFS") != null) {
hasGLUSTERFS = true;
}
- } catch (AmbariException e) {
+ } catch (AmbariException ignored) {
}
try {
@@ -82,7 +82,7 @@ public class CachedRoleCommandOrderProvider implements RoleCommandOrderProvider
cluster.getService("HDFS").getServiceComponent("JOURNALNODE") != null) {
isNameNodeHAEnabled = true;
}
- } catch (AmbariException e) {
+ } catch (AmbariException ignored) {
}
try {
@@ -91,7 +91,7 @@ public class CachedRoleCommandOrderProvider implements RoleCommandOrderProvider
cluster.getService("YARN").getServiceComponent("RESOURCEMANAGER").getServiceComponentHosts().size() > 1) {
isResourceManagerHAEnabled = true;
}
- } catch (AmbariException e) {
+ } catch (AmbariException ignored) {
}
int clusterCacheId = new HashCodeBuilder().append(cluster.getClusterId()).append(hasGLUSTERFS).append(isNameNodeHAEnabled).append
http://git-wip-us.apache.org/repos/asf/ambari/blob/749a5b2d/ambari-server/src/main/java/org/apache/ambari/server/metadata/RoleCommandOrder.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/metadata/RoleCommandOrder.java b/ambari-server/src/main/java/org/apache/ambari/server/metadata/RoleCommandOrder.java
index 58675ae..cebc1b7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/metadata/RoleCommandOrder.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/metadata/RoleCommandOrder.java
@@ -126,7 +126,8 @@ public class RoleCommandOrder {
try {
stack = ambariMetaInfo.getStack(stackId.getStackName(),
stackId.getStackVersion());
- } catch (AmbariException e) {
+ } catch (AmbariException ignored) {
+ // initialize() will fail with NPE
}
Map<String,Object> userData = stack.getRoleCommandOrder().getContent();
http://git-wip-us.apache.org/repos/asf/ambari/blob/749a5b2d/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialProvider.java
index 7643804..0521aa1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialProvider.java
@@ -18,7 +18,6 @@
package org.apache.ambari.server.security.encryption;
import java.io.File;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Random;
@@ -29,6 +28,7 @@ import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.security.credential.Credential;
import org.apache.ambari.server.security.credential.GenericKeyCredential;
+import org.apache.ambari.server.utils.Closeables;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -191,23 +191,14 @@ public class CredentialProvider {
try {
fo = new FileOutputStream(writeFilePath);
fo.write(passwd.getBytes());
- } catch (FileNotFoundException fe) {
- fe.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
- if (fo != null) {
- try {
- fo.close();
- } catch (IOException e) {
- }
- }
+ Closeables.closeSilently(fo);
}
} else {
LOG.error("Alias and file path are required arguments.");
}
- } else if (action.equalsIgnoreCase("RESET")) {
-
}
} else {
LOG.error("No arguments provided to " + "CredentialProvider");
http://git-wip-us.apache.org/repos/asf/ambari/blob/749a5b2d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/IPAKerberosOperationHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/IPAKerberosOperationHandler.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/IPAKerberosOperationHandler.java
index e118747..37779c6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/IPAKerberosOperationHandler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/IPAKerberosOperationHandler.java
@@ -40,6 +40,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.ambari.server.security.credential.PrincipalKeyCredential;
+import org.apache.ambari.server.utils.Closeables;
import org.apache.ambari.server.utils.ShellCommandUtil;
import org.apache.commons.lang.StringUtils;
import org.apache.directory.server.kerberos.shared.keytab.Keytab;
@@ -1093,19 +1094,8 @@ public class IPAKerberosOperationHandler extends KerberosOperationHandler {
LOG.error(message, e);
throw new KerberosOperationException(message, e);
} finally {
- if (osw != null) {
- try {
- osw.close();
- } catch (IOException e) {
- }
- }
-
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException e) {
- }
- }
+ Closeables.closeSilently(osw);
+ Closeables.closeSilently(reader);
}
if (process.exitValue() != 0) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/749a5b2d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandler.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandler.java
index 2880f6e..309170b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandler.java
@@ -474,7 +474,10 @@ public class MITKerberosOperationHandler extends KerberosOperationHandler {
}
tries++;
- try { Thread.sleep(1000 * configuration.getKerberosOperationRetryTimeout()); } catch (InterruptedException e) {}
+ try {
+ Thread.sleep(1000 * configuration.getKerberosOperationRetryTimeout());
+ } catch (InterruptedException ignored) {
+ }
String message = String.format("Retrying to execute kadmin after a wait of %d seconds :\n\tCommand: %s",
configuration.getKerberosOperationRetryTimeout(),
http://git-wip-us.apache.org/repos/asf/ambari/blob/749a5b2d/ambari-server/src/main/java/org/apache/ambari/server/stack/QuickLinksConfigurationModule.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/QuickLinksConfigurationModule.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/QuickLinksConfigurationModule.java
index 9554f0c..818026b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/QuickLinksConfigurationModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/QuickLinksConfigurationModule.java
@@ -41,10 +41,6 @@ public class QuickLinksConfigurationModule extends BaseModule<QuickLinksConfigur
public static final String QUICKLINKS_CONFIGURATION_KEY = "QuickLinksConfiguration";
- static {
- }
-
-
private QuickLinksConfigurationInfo moduleInfo;
private boolean valid = true;
private Set<String> errors = new HashSet<String>();
http://git-wip-us.apache.org/repos/asf/ambari/blob/749a5b2d/ambari-server/src/main/java/org/apache/ambari/server/stack/ThemeModule.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/ThemeModule.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/ThemeModule.java
index f07efea..932d929 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/ThemeModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/ThemeModule.java
@@ -41,10 +41,6 @@ public class ThemeModule extends BaseModule<ThemeModule, ThemeInfo> implements V
public static final String THEME_KEY = "Theme";
- static {
- }
-
-
private ThemeInfo moduleInfo;
private boolean valid = true;
private Set<String> errors = new HashSet<String>();
http://git-wip-us.apache.org/repos/asf/ambari/blob/749a5b2d/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
index 3fb036d..54752f9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
@@ -552,7 +552,7 @@ public class ConfigHelper {
String stackPropertyConfigType = fileNameToConfigType(serviceProperty.getFilename());
try {
result.add(actualConfigs.get(stackPropertyConfigType).getProperties().get(serviceProperty.getName()));
- } catch (Exception ex) {
+ } catch (Exception ignored) {
}
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/749a5b2d/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 c9d497f..3d5ef85 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
@@ -921,17 +921,13 @@ public String getVersion() {
public Map<String, ThemeInfo> getThemesMap() {
if (themesMap == null) {
- synchronized (this) {
- }
- if (themesMap == null) {
- Map<String, ThemeInfo> tmp = new TreeMap<String, ThemeInfo>();
- if (themes != null) {
- for (ThemeInfo theme : themes) {
- tmp.put(theme.getFileName(), theme);
- }
+ Map<String, ThemeInfo> tmp = new TreeMap<>();
+ if (themes != null) {
+ for (ThemeInfo theme : themes) {
+ tmp.put(theme.getFileName(), theme);
}
- themesMap = tmp;
}
+ themesMap = tmp;
}
return themesMap;
}
@@ -959,17 +955,13 @@ public String getVersion() {
public Map<String, QuickLinksConfigurationInfo> getQuickLinksConfigurationsMap() {
if (quickLinksConfigurationsMap == null) {
- synchronized (this) {
- }
- if (quickLinksConfigurationsMap == null) {
- Map<String, QuickLinksConfigurationInfo> tmp = new TreeMap<String, QuickLinksConfigurationInfo>();
- if (quickLinksConfigurations != null) {
- for (QuickLinksConfigurationInfo quickLinksConfiguration : quickLinksConfigurations) {
- tmp.put(quickLinksConfiguration.getFileName(), quickLinksConfiguration);
- }
+ Map<String, QuickLinksConfigurationInfo> tmp = new TreeMap<>();
+ if (quickLinksConfigurations != null) {
+ for (QuickLinksConfigurationInfo quickLinksConfiguration : quickLinksConfigurations) {
+ tmp.put(quickLinksConfiguration.getFileName(), quickLinksConfiguration);
}
- quickLinksConfigurationsMap = tmp;
}
+ quickLinksConfigurationsMap = tmp;
}
return quickLinksConfigurationsMap;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/749a5b2d/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
index b62c834..86ba1a1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
@@ -3196,8 +3196,7 @@ public class ClusterImpl implements Cluster {
StackId stackId = getCurrentStackVersion();
StackInfo stackInfo = ambariMetaInfo.getStack(stackId.getStackName(), stackId.getStackVersion());
return stackInfo.getConfigPropertiesTypes(configType);
- } catch (AmbariException e) {
-
+ } catch (AmbariException ignored) {
}
return new HashMap<>();
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/749a5b2d/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java
index 99e50fb..590a3e8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java
@@ -97,20 +97,18 @@ public class SchemaUpgradeHelper {
throw new RuntimeException("Unable to read database version", e);
} finally {
- {
- if (rs != null) {
- try {
- rs.close();
- } catch (SQLException e) {
- throw new RuntimeException("Cannot close result set");
- }
+ if (rs != null) {
+ try {
+ rs.close();
+ } catch (SQLException e) {
+ throw new RuntimeException("Cannot close result set");
}
- if (statement != null) {
- try {
- statement.close();
- } catch (SQLException e) {
- throw new RuntimeException("Cannot close statement");
- }
+ }
+ if (statement != null) {
+ try {
+ statement.close();
+ } catch (SQLException e) {
+ throw new RuntimeException("Cannot close statement");
}
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/749a5b2d/ambari-server/src/main/java/org/apache/ambari/server/utils/Closeables.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/utils/Closeables.java b/ambari-server/src/main/java/org/apache/ambari/server/utils/Closeables.java
new file mode 100644
index 0000000..e120d4c
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/utils/Closeables.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.utils;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Utilities for closing @{link Closeable}s.
+ *
+ * @see com.google.common.io.Closeables
+ */
+public final class Closeables {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(Closeables.class);
+
+ /**
+ * Closes <code>c</code> ignoring any <code>IOException</code>s.
+ */
+ public static void closeSilently(Closeable c) {
+ close(c, null);
+ }
+
+ /**
+ * Closes <code>c</code> logging any <code>IOException</code> as warning via this class' logger.
+ */
+ public static void closeLoggingExceptions(Closeable c) {
+ closeLoggingExceptions(c, LOGGER);
+ }
+
+ /**
+ * Closes <code>c</code> logging any <code>IOException</code> via the specified <code>logger</code>.
+ */
+ public static void closeLoggingExceptions(Closeable c, Logger logger) {
+ close(c, logger);
+ }
+
+ private static void close(Closeable c, Logger logger) {
+ if (c != null) {
+ try {
+ c.close();
+ } catch (IOException e) {
+ if (logger != null) {
+ logger.warn("IOException while closing Closeable", e);
+ }
+ }
+ }
+ }
+
+ private Closeables() {
+ throw new UnsupportedOperationException("No instances");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/749a5b2d/ambari-server/src/main/java/org/apache/ambari/server/view/ViewDirectoryWatcher.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewDirectoryWatcher.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewDirectoryWatcher.java
index 2ccf757..31f53f1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewDirectoryWatcher.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewDirectoryWatcher.java
@@ -39,6 +39,7 @@ import java.util.zip.ZipFile;
import javax.annotation.Nullable;
import org.apache.ambari.server.configuration.Configuration;
+import org.apache.ambari.server.utils.Closeables;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -238,12 +239,7 @@ public class ViewDirectoryWatcher implements DirectoryWatcher {
LOG.info("Verification failed ", e);
return false;
} finally {
- if (zipFile != null) {
- try {
- zipFile.close();
- } catch (IOException e) {
- }
- }
+ Closeables.closeSilently(zipFile);
}
return true;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/749a5b2d/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
index cb1489a..df4a2f2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
@@ -19,6 +19,7 @@
package org.apache.ambari.server.view;
import java.beans.IntrospectionException;
+import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@@ -92,6 +93,7 @@ import org.apache.ambari.server.security.authorization.RoleAuthorization;
import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.stack.OsFamily;
+import org.apache.ambari.server.utils.Closeables;
import org.apache.ambari.server.utils.VersionUtils;
import org.apache.ambari.server.view.configuration.AutoInstanceConfig;
import org.apache.ambari.server.view.configuration.EntityConfig;
@@ -1819,19 +1821,8 @@ public class ViewRegistry {
} catch (IOException e) {
LOG.error("Error occurred while configuring logs for {}", viewDefinition.getName());
} finally {
- if (ambariLog4jStream != null) {
- try {
- ambariLog4jStream.close();
- } catch (IOException e) {
- }
- }
-
- if (viewLog4jStream != null) {
- try {
- viewLog4jStream.close();
- } catch (IOException e) {
- }
- }
+ Closeables.closeSilently(ambariLog4jStream);
+ Closeables.closeSilently(viewLog4jStream);
}
}
}
@@ -2023,11 +2014,8 @@ public class ViewRegistry {
classLoader = extractor.extractViewArchive(viewDefinition, archiveFile, extractedArchiveDirFile);
return true;
} finally {
- if (classLoader != null && classLoader instanceof ViewClassLoader) {
- try {
- ((ViewClassLoader) classLoader).close();
- } catch (IOException e) {
- }
+ if (classLoader instanceof Closeable) {
+ Closeables.closeSilently((Closeable) classLoader);
}
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/749a5b2d/ambari-server/src/main/java/org/apache/ambari/server/view/ViewURLStreamProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewURLStreamProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewURLStreamProvider.java
index 24d3527..2d7d8a6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewURLStreamProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewURLStreamProvider.java
@@ -252,7 +252,8 @@ public class ViewURLStreamProvider implements org.apache.ambari.view.URLStreamPr
Integer.toString(url.getPort() == -1
? url.getDefaultPort()
: url.getPort()));
- } catch (MalformedURLException ex) {
+ } catch (MalformedURLException ignored) {
+ // actual connection attempt will throw
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/749a5b2d/ambari-server/src/test/java/org/apache/ambari/server/utils/CloseablesTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/utils/CloseablesTest.java b/ambari-server/src/test/java/org/apache/ambari/server/utils/CloseablesTest.java
new file mode 100644
index 0000000..4eda065
--- /dev/null
+++ b/ambari-server/src/test/java/org/apache/ambari/server/utils/CloseablesTest.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.utils;
+
+import static org.easymock.EasyMock.anyString;
+import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.createStrictMock;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.powermock.api.easymock.PowerMock.replayAll;
+import static org.powermock.api.easymock.PowerMock.verifyAll;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+
+public class CloseablesTest {
+
+ @Test
+ public void silentIfSucceeds() throws Exception {
+ Closeable normalCloseable = createNiceMock(Closeable.class);
+ normalCloseable.close();
+ replayAll();
+
+ Closeables.closeSilently(normalCloseable);
+
+ verifyAll();
+ }
+
+ @Test
+ public void silentIfThrows() throws Exception {
+ Closeable throwingCloseable = createNiceMock(Closeable.class);
+ throwingCloseable.close();
+ expectLastCall().andThrow(new IOException());
+ replayAll();
+
+ Closeables.closeSilently(throwingCloseable);
+
+ verifyAll();
+ }
+
+ @Test
+ public void succeedsWithoutLog() throws Exception {
+ Closeable normalCloseable = createNiceMock(Closeable.class);
+ Logger logger = createStrictMock(Logger.class);
+ normalCloseable.close();
+ replayAll();
+
+ Closeables.closeLoggingExceptions(normalCloseable, logger);
+
+ verifyAll();
+ }
+
+ @Test
+ public void warnWithThrownException() throws Exception {
+ Closeable throwingCloseable = createNiceMock(Closeable.class);
+ Logger logger = createNiceMock(Logger.class);
+ IOException e = new IOException();
+ throwingCloseable.close();
+ expectLastCall().andThrow(e);
+ logger.warn(anyString(), eq(e));
+ replayAll();
+
+ Closeables.closeLoggingExceptions(throwingCloseable, logger);
+
+ verifyAll();
+ }
+
+ @Test
+ public void ignoresNullCloseable() {
+ Closeables.closeSilently(null);
+ }
+
+}
[14/26] ambari git commit: AMBARI-19271 Update Zeppelin version in
service def to 0.6.2 instead of 0.7.0 (r-kamath)
Posted by nc...@apache.org.
AMBARI-19271 Update Zeppelin version in service def to 0.6.2 instead of 0.7.0 (r-kamath)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/79903685
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/79903685
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/79903685
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 79903685076122292f8773efa29ef2496fc3aeb8
Parents: 0f2ec4f
Author: Renjith Kamath <re...@gmail.com>
Authored: Wed Dec 21 21:02:30 2016 +0530
Committer: Renjith Kamath <re...@gmail.com>
Committed: Wed Dec 21 21:12:52 2016 +0530
----------------------------------------------------------------------
.../main/resources/stacks/HDP/2.6/services/ZEPPELIN/metainfo.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/79903685/ambari-server/src/main/resources/stacks/HDP/2.6/services/ZEPPELIN/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/ZEPPELIN/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/ZEPPELIN/metainfo.xml
index e8ab191..dad54e8 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/ZEPPELIN/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/ZEPPELIN/metainfo.xml
@@ -21,7 +21,7 @@
<services>
<service>
<name>ZEPPELIN</name>
- <version>0.7.0.2.6</version>
+ <version>0.6.2.2.6</version>
</service>
</services>
</metainfo>
[23/26] ambari git commit: AMBARI-19280 Cover global controllers with
unit tests. (atkach)
Posted by nc...@apache.org.
AMBARI-19280 Cover global controllers with unit tests. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/98a83c5f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/98a83c5f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/98a83c5f
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 98a83c5f909b5fe5b8debe249496978bd3c6c7d2
Parents: 633ac3b
Author: Andrii Tkach <at...@apache.org>
Authored: Thu Dec 22 13:16:46 2016 +0200
Committer: Andrii Tkach <at...@apache.org>
Committed: Thu Dec 22 16:50:55 2016 +0200
----------------------------------------------------------------------
.../global/background_operations_controller.js | 60 +-
.../controllers/global/cluster_controller.js | 179 +++---
.../global/configuration_controller.js | 14 +-
.../app/controllers/global/update_controller.js | 5 +-
.../global/user_settings_controller.js | 67 ++-
.../global/background_operations_test.js | 241 +++++++-
.../global/cluster_controller_test.js | 592 +++++++++++++++++++
.../global/configuration_controller_test.js | 163 +++++
.../global/errors_handler_controller_test.js | 10 +
.../global/update_controller_test.js | 122 ++++
.../global/user_settings_controller_test.js | 300 ++++++++++
11 files changed, 1607 insertions(+), 146 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/98a83c5f/ambari-web/app/controllers/global/background_operations_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/background_operations_controller.js b/ambari-web/app/controllers/global/background_operations_controller.js
index 9612141..3a011f5 100644
--- a/ambari-web/app/controllers/global/background_operations_controller.js
+++ b/ambari-web/app/controllers/global/background_operations_controller.js
@@ -320,36 +320,46 @@ App.BackgroundOperationsController = Em.Controller.extend({
/**
* parse request context and if keyword "_PARSE_" is present then format it
- * @param requestContext
+ * @param {string} requestContext
* @return {Object}
*/
parseRequestContext: function (requestContext) {
- var parsedRequestContext;
- var service;
- var contextCommand;
+ var context = {};
if (requestContext) {
if (requestContext.indexOf(App.BackgroundOperationsController.CommandContexts.PREFIX) !== -1) {
- var contextSplits = requestContext.split('.');
- contextCommand = contextSplits[1];
- service = contextSplits[2];
- switch(contextCommand){
- case "STOP":
- case "START":
- if (service === 'ALL_SERVICES') {
- parsedRequestContext = Em.I18n.t("requestInfo." + contextCommand.toLowerCase()).format(Em.I18n.t('common.allServices'));
- } else {
- parsedRequestContext = Em.I18n.t("requestInfo." + contextCommand.toLowerCase()).format(App.format.role(service, true));
- }
- break;
- case "ROLLING-RESTART":
- parsedRequestContext = Em.I18n.t("rollingrestart.rest.context").format(App.format.role(service, true), contextSplits[3], contextSplits[4]);
- break;
- }
+ context = this.getRequestContextWithPrefix(requestContext);
} else {
- parsedRequestContext = requestContext;
+ context.parsedRequestContext = requestContext;
}
} else {
- parsedRequestContext = Em.I18n.t('requestInfo.unspecified');
+ context.parsedRequestContext = Em.I18n.t('requestInfo.unspecified');
+ }
+ return context;
+ },
+
+ /**
+ *
+ * @param {string} requestContext
+ * @returns {{requestContext: *, dependentService: *, contextCommand: *}}
+ */
+ getRequestContextWithPrefix: function (requestContext) {
+ var contextSplits = requestContext.split('.'),
+ parsedRequestContext,
+ contextCommand = contextSplits[1],
+ service = contextSplits[2];
+
+ switch (contextCommand) {
+ case "STOP":
+ case "START":
+ if (service === 'ALL_SERVICES') {
+ parsedRequestContext = Em.I18n.t("requestInfo." + contextCommand.toLowerCase()).format(Em.I18n.t('common.allServices'));
+ } else {
+ parsedRequestContext = Em.I18n.t("requestInfo." + contextCommand.toLowerCase()).format(App.format.role(service, true));
+ }
+ break;
+ case "ROLLING-RESTART":
+ parsedRequestContext = Em.I18n.t("rollingrestart.rest.context").format(App.format.role(service, true), contextSplits[3], contextSplits[4]);
+ break;
}
return {
requestContext: parsedRequestContext,
@@ -363,13 +373,13 @@ App.BackgroundOperationsController = Em.Controller.extend({
/**
* Onclick handler for background operations number located right to logo
*/
- showPopup: function(){
+ showPopup: function () {
// load the checkbox on footer first, then show popup.
var self = this;
App.router.get('userSettingsController').dataLoading('show_bg').done(function (initValue) {
App.updater.immediateRun('requestMostRecent');
- if(self.get('popupView') && App.HostPopup.get('isBackgroundOperations')){
- self.set ('popupView.isNotShowBgChecked', !initValue);
+ if (self.get('popupView') && App.HostPopup.get('isBackgroundOperations')) {
+ self.set('popupView.isNotShowBgChecked', !initValue);
self.set('popupView.isOpen', true);
var el = $(self.get('popupView.element'));
el.appendTo('#wrapper');
http://git-wip-us.apache.org/repos/asf/ambari/blob/98a83c5f/ambari-web/app/controllers/global/cluster_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js
index d7cedd3..21508ab 100644
--- a/ambari-web/app/controllers/global/cluster_controller.js
+++ b/ambari-web/app/controllers/global/cluster_controller.js
@@ -164,6 +164,7 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, {
error: 'getServerClockErrorCallback'
});
},
+
getServerClockSuccessCallback: function (data) {
var clientClock = new Date().getTime();
var serverClock = (data.RootServiceComponents.server_clock).toString();
@@ -171,8 +172,8 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, {
App.set('clockDistance', serverClock - clientClock);
App.set('currentServerTime', parseInt(serverClock));
},
- getServerClockErrorCallback: function () {
- },
+
+ getServerClockErrorCallback: Em.K,
getUrl: function (testUrl, url) {
return (App.get('testMode')) ? testUrl : App.get('apiPrefix') + '/clusters/' + App.get('clusterName') + url;
@@ -182,10 +183,10 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, {
* load all data and update load status
*/
loadClusterData: function () {
- var self = this;
this.loadAuthorizations();
this.getAllHostNames();
this.loadAmbariProperties();
+
if (!App.get('clusterName')) {
return;
}
@@ -196,38 +197,49 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, {
}
App.router.get('userSettingsController').getAllUserSettings();
App.router.get('errorsHandlerController').loadErrorLogs();
- var clusterUrl = this.getUrl('/data/clusters/cluster.json', '?fields=Clusters');
var hostsController = App.router.get('mainHostController');
hostsController.set('isCountersUpdating', true);
hostsController.updateStatusCounters();
+ this.loadClusterInfo();
+ this.restoreUpgradeState();
+ App.router.get('wizardWatcherController').getUser();
+
+ this.loadClusterDataToModel();
+
+ //force clear filters for hosts page to load all data
+ App.db.setFilterConditions('mainHostController', null);
+
+ //load cluster-env, used by alert check tolerance
+ // TODO services auto-start
+ App.router.get('updateController').updateClusterEnv();
+ },
+
+ loadClusterInfo: function() {
+ var clusterUrl = this.getUrl('/data/clusters/cluster.json', '?fields=Clusters');
App.HttpClient.get(clusterUrl, App.clusterMapper, {
complete: function (jqXHR, textStatus) {
App.set('isCredentialStorePersistent', Em.getWithDefault(App.Cluster.find().findProperty('clusterName', App.get('clusterName')), 'isCredentialStorePersistent', false));
}
- }, function (jqXHR, textStatus) {
- });
-
-
- self.restoreUpgradeState();
-
- App.router.get('wizardWatcherController').getUser();
+ }, Em.K);
+ },
- var updater = App.router.get('updateController');
+ /**
+ * Order of loading:
+ * 1. load all created service components
+ * 2. request for service components supported by stack
+ * 3. load stack components to model
+ * 4. request for services
+ * 5. put services in cache
+ * 6. request for hosts and host-components (single call)
+ * 7. request for service metrics
+ * 8. load host-components to model
+ * 9. load services from cache with metrics to model
+ */
+ loadClusterDataToModel: function() {
+ var self = this;
- /**
- * Order of loading:
- * 1. load all created service components
- * 2. request for service components supported by stack
- * 3. load stack components to model
- * 4. request for services
- * 5. put services in cache
- * 6. request for hosts and host-components (single call)
- * 7. request for service metrics
- * 8. load host-components to model
- * 9. load services from cache with metrics to model
- */
- self.loadStackServiceComponents(function (data) {
+ this.loadStackServiceComponents(function (data) {
data.items.forEach(function (service) {
service.StackServices.is_selected = true;
service.StackServices.is_installed = false;
@@ -235,64 +247,68 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, {
App.stackServiceMapper.mapStackServices(data);
App.config.setPreDefinedServiceConfigs(true);
self.updateLoadStatus('stackComponents');
- updater.updateServices(function () {
- self.updateLoadStatus('services');
-
- //hosts should be loaded after services in order to properly populate host-component relation in App.cache.services
- updater.updateHost(function () {
- self.set('isHostsLoaded', true);
- console.time('Overall alerts loading time');
- updater.updateAlertGroups(function () {
- updater.updateAlertDefinitions(function () {
- updater.updateAlertDefinitionSummary(function () {
- updater.updateUnhealthyAlertInstances(function () {
- console.timeEnd('Overall alerts loading time');
- self.set('isAlertsLoaded', true);
- });
- });
- });
- });
- });
- App.config.loadConfigsFromStack(App.Service.find().mapProperty('serviceName')).complete(function () {
- App.config.loadClusterConfigsFromStack().complete(function () {
- self.set('isConfigsPropertiesLoaded', true);
+ self.loadServicesAndComponents();
+ });
+ },
+
+ loadServicesAndComponents: function() {
+ var updater = App.router.get('updateController');
+ var self = this;
+
+ updater.updateServices(function () {
+ self.updateLoadStatus('services');
+
+ //hosts should be loaded after services in order to properly populate host-component relation in App.cache.services
+ updater.updateHost(function () {
+ self.set('isHostsLoaded', true);
+ self.loadAlerts();
+ });
+ self.loadConfigProperties();
+ // components state loading doesn't affect overall progress
+ updater.updateComponentsState(function () {
+ self.set('isComponentsStateLoaded', true);
+ // service metrics should be loaded after components state for mapping service components to service in the DS model
+ // service metrics loading doesn't affect overall progress
+ updater.updateServiceMetric(function () {
+ self.set('isServiceMetricsLoaded', true);
+ // make second call, because first is light since it doesn't request host-component metrics
+ updater.updateServiceMetric(function() {
+ self.set('isHostComponentMetricsLoaded', true);
});
- });
- // components state loading doesn't affect overall progress
- updater.updateComponentsState(function () {
- self.set('isComponentsStateLoaded', true);
- // service metrics should be loaded after components state for mapping service components to service in the DS model
- // service metrics loading doesn't affect overall progress
- updater.updateServiceMetric(function () {
- self.set('isServiceMetricsLoaded', true);
- // make second call, because first is light since it doesn't request host-component metrics
- updater.updateServiceMetric(function() {
- self.set('isHostComponentMetricsLoaded', true);
- });
- // components config loading doesn't affect overall progress
- updater.updateComponentConfig(function () {
- self.set('isComponentsConfigLoaded', true);
- });
+ // components config loading doesn't affect overall progress
+ updater.updateComponentConfig(function () {
+ self.set('isComponentsConfigLoaded', true);
});
});
});
});
+ },
- //force clear filters for hosts page to load all data
- App.db.setFilterConditions('mainHostController', null);
-
- //load cluster-env, used by alert check tolerance // TODO services auto-start
- updater.updateClusterEnv();
+ loadConfigProperties: function() {
+ var self = this;
- /* Root service mapper maps all the data exposed under Ambari root service which includes ambari configurations i.e ambari-properties
- ** This is useful information but its not being used in the code anywhere as of now
+ App.config.loadConfigsFromStack(App.Service.find().mapProperty('serviceName')).complete(function () {
+ App.config.loadClusterConfigsFromStack().complete(function () {
+ self.set('isConfigsPropertiesLoaded', true);
+ });
+ });
+ },
- self.loadRootService().done(function (data) {
- App.rootServiceMapper.map(data);
- self.updateLoadStatus('rootService');
- });
+ loadAlerts: function() {
+ var updater = App.router.get('updateController');
+ var self = this;
- */
+ console.time('Overall alerts loading time');
+ updater.updateAlertGroups(function () {
+ updater.updateAlertDefinitions(function () {
+ updater.updateAlertDefinitionSummary(function () {
+ updater.updateUnhealthyAlertInstances(function () {
+ console.timeEnd('Overall alerts loading time');
+ self.set('isAlertsLoaded', true);
+ });
+ });
+ });
+ });
},
/**
@@ -353,7 +369,7 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, {
isRunningState: function(status){
if (status) {
- return "IN_PROGRESS" == status || "PENDING" == status || status.contains("HOLDING");
+ return "IN_PROGRESS" === status || "PENDING" === status || status.contains("HOLDING");
} else {
//init state
return true;
@@ -364,7 +380,7 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, {
* ABORTED should be handled as SUSPENDED for the lastUpgradeItem
* */
isSuspendedState: function(status){
- return "ABORTED" == status;
+ return "ABORTED" === status;
},
loadRootService: function () {
@@ -385,12 +401,13 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, {
/**
*
* @param callback
+ * @returns {?object}
*/
loadStackServiceComponents: function (callback) {
var callbackObj = {
loadStackServiceComponentsSuccess: callback
};
- App.ajax.send({
+ return App.ajax.send({
name: 'wizard.service_components',
data: {
stackUrl: App.get('stackVersionURL'),
@@ -433,9 +450,7 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, {
App.router.get('mainController').monitorInactivity();
},
- loadAmbariPropertiesError: function () {
-
- },
+ loadAmbariPropertiesError: Em.K,
updateClusterData: function () {
var testUrl = '/data/clusters/HDP2/cluster.json';
@@ -463,9 +478,7 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, {
App.set("allHostNames", data.items.mapProperty("Hosts.host_name"));
},
- getHostNamesError: function () {
-
- },
+ getHostNamesError: Em.K,
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/98a83c5f/ambari-web/app/controllers/global/configuration_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/configuration_controller.js b/ambari-web/app/controllers/global/configuration_controller.js
index 43afc0f..806064a 100644
--- a/ambari-web/app/controllers/global/configuration_controller.js
+++ b/ambari-web/app/controllers/global/configuration_controller.js
@@ -61,6 +61,12 @@ App.ConfigurationController = Em.Controller.extend({
}
return isDifferent;
},
+
+ /**
+ *
+ * @param {Array} siteNames
+ * @returns {*}
+ */
loadFromDB: function (siteNames) {
var dfd = $.Deferred();
var configs = App.db.getConfigs().filter(function (site) {
@@ -80,7 +86,7 @@ App.ConfigurationController = Em.Controller.extend({
var dfd = $.Deferred();
if (!tags.everyProperty('tagName')) {
var configTags;
- var jqXhr = this.loadConfigTags();
+ var jqXhr = this.loadConfigTags();
jqXhr.done(function (data) {
configTags = data.Clusters.desired_configs;
tags.forEach(function (_tag) {
@@ -88,10 +94,10 @@ App.ConfigurationController = Em.Controller.extend({
_tag.tagName = configTags[_tag.siteName].tag;
}
}, self);
- self.loadConfigsByTags(tags,dfd);
+ self.loadConfigsByTags(tags, dfd);
});
} else {
- self.loadConfigsByTags(tags,dfd);
+ self.loadConfigsByTags(tags, dfd);
}
return dfd.promise();
},
@@ -101,7 +107,7 @@ App.ConfigurationController = Em.Controller.extend({
* @params tags
* @params dfd jqXhr promise
*/
- loadConfigsByTags: function (tags,dfd) {
+ loadConfigsByTags: function (tags, dfd) {
var self = this;
var loadedConfigs = [];
App.config.loadConfigsByTags(tags).done(function (data) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/98a83c5f/ambari-web/app/controllers/global/update_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/update_controller.js b/ambari-web/app/controllers/global/update_controller.js
index ce93b34..a3aee37 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -410,10 +410,10 @@ App.UpdateController = Em.Controller.extend({
params.callback(skipCall, queryParams);
}
},
- getHostByHostComponentsErrorCallback: function () {
+ getHostByHostComponentsErrorCallback: Em.K,
- },
graphs: [],
+
graphsUpdate: function (callback) {
var existedGraphs = [];
this.get('graphs').forEach(function (_graph) {
@@ -524,6 +524,7 @@ App.UpdateController = Em.Controller.extend({
complete: callback
});
},
+
updateComponentConfig: function (callback) {
var testUrl = '/data/services/host_component_stale_configs.json';
var componentConfigUrl = this.getUrl(testUrl, '/components?host_components/HostRoles/stale_configs=true&fields=host_components/HostRoles/display_name,host_components/HostRoles/service_name,host_components/HostRoles/state,host_components/HostRoles/maintenance_state,host_components/HostRoles/host_name,host_components/HostRoles/public_host_name,host_components/HostRoles/stale_configs,host_components/HostRoles/desired_admin_state&minimal_response=true');
http://git-wip-us.apache.org/repos/asf/ambari/blob/98a83c5f/ambari-web/app/controllers/global/user_settings_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/user_settings_controller.js b/ambari-web/app/controllers/global/user_settings_controller.js
index 9580400..e971cba 100644
--- a/ambari-web/app/controllers/global/user_settings_controller.js
+++ b/ambari-web/app/controllers/global/user_settings_controller.js
@@ -169,10 +169,10 @@ App.UserSettingsController = Em.Controller.extend(App.UserPref, {
* @returns {*}
*/
postUserPref: function (key, value) {
- var k = key.startsWith('userSettingsKeys.') ? key : 'userSettingsKeys.' + key + '.name';
- var kk = k.replace('userSettingsKeys.', '').replace('.name', '');
- this.set('userSettings.' + kk, value);
- return this._super(this.get(k), value);
+ var normalizedKey = key.startsWith('userSettingsKeys.') ? key : 'userSettingsKeys.' + key + '.name';
+ var shortKey = normalizedKey.replace('userSettingsKeys.', '').replace('.name', '');
+ this.set('userSettings.' + shortKey, value);
+ return this._super(this.get(normalizedKey), value);
},
/**
@@ -187,8 +187,7 @@ App.UserSettingsController = Em.Controller.extend(App.UserPref, {
return;
}
- this.dataLoading()
- .done(function(response) {
+ this.dataLoading().done(function(response) {
self.loadPrivileges().complete(function() {
self._showSettingsPopup(response);
});
@@ -207,27 +206,11 @@ App.UserSettingsController = Em.Controller.extend(App.UserPref, {
},
loadPrivilegesSuccessCallback: function(data) {
- var key;
- var privileges = {
- clusters: {},
- views: {}
- };
- data.items.forEach(function(privilege) {
- privilege = privilege.PrivilegeInfo;
- if(privilege.type === 'CLUSTER'){
- // This is cluster
- privileges.clusters[privilege.cluster_name] = privileges.clusters[privilege.cluster_name] || [];
- privileges.clusters[privilege.cluster_name].push(privilege.permission_label);
- } else if ( privilege.type === 'VIEW'){
- privileges.views[privilege.instance_name] = privileges.views[privilege.instance_name] || { privileges:[]};
- privileges.views[privilege.instance_name].version = privilege.version;
- privileges.views[privilege.instance_name].view_name = privilege.view_name;
- privileges.views[privilege.instance_name].privileges.push(privilege.permission_label);
- }
- });
- // restructure data for view
- var clusters = [];
- var views = [];
+ var key,
+ privileges = this.parsePrivileges(data),
+ clusters = [],
+ views = [];
+
for (key in privileges.clusters) {
clusters.push({
name: key,
@@ -245,12 +228,38 @@ App.UserSettingsController = Em.Controller.extend(App.UserPref, {
privileges.clusters = clusters;
privileges.views = views;
this.set('privileges', data.items.length ? privileges : null);
- this.set('noClusterPriv', $.isEmptyObject(privileges.clusters));
- this.set('noViewPriv', $.isEmptyObject(privileges.views));
+ this.set('noClusterPriv', Em.isEmpty(clusters));
+ this.set('noViewPriv', Em.isEmpty(views));
this.set('hidePrivileges', this.get('noClusterPriv') && this.get('noViewPriv'));
},
/**
+ *
+ * @param {?object} data
+ * @returns {{clusters: {}, views: {}}}
+ */
+ parsePrivileges: function (data) {
+ var privileges = {
+ clusters: {},
+ views: {}
+ };
+ data.items.forEach(function (privilege) {
+ privilege = privilege.PrivilegeInfo;
+ if (privilege.type === 'CLUSTER') {
+ // This is cluster
+ privileges.clusters[privilege.cluster_name] = privileges.clusters[privilege.cluster_name] || [];
+ privileges.clusters[privilege.cluster_name].push(privilege.permission_label);
+ } else if (privilege.type === 'VIEW') {
+ privileges.views[privilege.instance_name] = privileges.views[privilege.instance_name] || {privileges: []};
+ privileges.views[privilege.instance_name].version = privilege.version;
+ privileges.views[privilege.instance_name].view_name = privilege.view_name;
+ privileges.views[privilege.instance_name].privileges.push(privilege.permission_label);
+ }
+ });
+ return privileges;
+ },
+
+ /**
* Show popup with settings for user
* Don't call this method directly! Use <code>showSettingsPopup</code>
*
http://git-wip-us.apache.org/repos/asf/ambari/blob/98a83c5f/ambari-web/test/controllers/global/background_operations_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/global/background_operations_test.js b/ambari-web/test/controllers/global/background_operations_test.js
index b22c105..323f090 100644
--- a/ambari-web/test/controllers/global/background_operations_test.js
+++ b/ambari-web/test/controllers/global/background_operations_test.js
@@ -31,9 +31,7 @@ require('utils/host_progress_popup');
describe('App.BackgroundOperationsController', function () {
- var controller = App.BackgroundOperationsController.create({
- isInitLoading: Em.K
- });
+ var controller = App.BackgroundOperationsController.create();
describe('#getQueryParams', function () {
/**
@@ -713,4 +711,241 @@ describe('App.BackgroundOperationsController', function () {
expect(request.get('isRunning')).to.equal(true);
});
});
+
+ describe("#isInitLoading()", function () {
+
+ it("should return false when not on HOSTS_LIST level", function() {
+ controller.set('levelInfo', Em.Object.create({
+ name: 'SERVICES_LIST'
+ }));
+ expect(controller.isInitLoading()).to.be.false;
+ });
+
+ it("should return false when no request found", function() {
+ controller.set('levelInfo', Em.Object.create({
+ name: 'HOSTS_LIST',
+ requestId: 1
+ }));
+ controller.set('services', []);
+ expect(controller.isInitLoading()).to.be.false;
+ });
+
+ it("should return false when no request found", function() {
+ controller.set('levelInfo', Em.Object.create({
+ name: 'HOSTS_LIST',
+ requestId: 1
+ }));
+ controller.set('services', []);
+ expect(controller.isInitLoading()).to.be.false;
+ });
+
+ it("should return false when request has hosts", function() {
+ controller.set('levelInfo', Em.Object.create({
+ name: 'HOSTS_LIST',
+ requestId: 1
+ }));
+ controller.set('services', [Em.Object.create({
+ id: 1,
+ hostsMap: {
+ 'host1': {}
+ }
+ })]);
+ expect(controller.isInitLoading()).to.be.false;
+ });
+
+ it("should return true when no request has no hosts", function() {
+ controller.set('levelInfo', Em.Object.create({
+ name: 'HOSTS_LIST',
+ requestId: 1
+ }));
+ controller.set('services', [Em.Object.create({
+ id: 1,
+ hostsMap: {}
+ })]);
+ expect(controller.isInitLoading()).to.be.true;
+ });
+ });
+
+ describe("#callBackFilteredByTask()", function () {
+ var data = {
+ Tasks: {
+ request_id: 1,
+ host_name: 'host1',
+ id: 2,
+ status: 'foo',
+ stdout: 'bar',
+ stderr: 'barfoo',
+ command: 'cmd',
+ custom_command_name: 'custom-cmd',
+ structured_out: 'str-out',
+ output_log: 'out-log',
+ error_log: 'err-log'
+ }
+ };
+
+ beforeEach(function() {
+ sinon.stub(App, 'dateTime').returns(1);
+ });
+
+ afterEach(function() {
+ App.dateTime.restore();
+ });
+
+ it("should set task info", function() {
+ var task = {
+ Tasks: {
+ id: 2
+ }
+ };
+ controller.set('services', [
+ Em.Object.create({
+ id: 1,
+ hostsMap: {
+ host1: {
+ logTasks: [task]
+ }
+ }
+ })
+ ]);
+
+ controller.callBackFilteredByTask(data);
+ expect(task).to.be.eql({
+ "Tasks": {
+ "id": 2,
+ "status": "foo",
+ "stdout": "bar",
+ "stderr": "barfoo",
+ "command": "cmd",
+ "custom_command_name": "custom-cmd",
+ "structured_out": "str-out",
+ "output_log": "out-log",
+ "error_log": "err-log"
+ }
+ });
+ expect(controller.get('serviceTimestamp')).to.be.equal(1);
+ });
+ });
+
+ describe("#parseRequestContext()", function () {
+
+ beforeEach(function() {
+ sinon.stub(controller, 'getRequestContextWithPrefix').returns({
+ parsedRequestContext: 'CTX_WITH_PREFIX'
+ });
+ });
+
+ afterEach(function() {
+ controller.getRequestContextWithPrefix.restore();
+ });
+
+ it("no requestContext specified", function() {
+ expect(controller.parseRequestContext()).to.be.eql({
+ parsedRequestContext: Em.I18n.t('requestInfo.unspecified')
+ });
+ });
+
+ it("requestContext specified", function() {
+ expect(controller.parseRequestContext('CTX')).to.be.eql({
+ parsedRequestContext: 'CTX'
+ });
+ });
+
+ it("requestContext specified with prefix", function() {
+ expect(controller.parseRequestContext(App.BackgroundOperationsController.CommandContexts.PREFIX)).to.be.eql({
+ parsedRequestContext: 'CTX_WITH_PREFIX'
+ });
+ });
+ });
+
+ describe("#getRequestContextWithPrefix()", function () {
+
+ beforeEach(function() {
+ sinon.stub(App.format, 'role', function (arg) {
+ return arg;
+ })
+ });
+
+ afterEach(function() {
+ App.format.role.restore();
+ });
+
+ it("custom command", function() {
+ expect(controller.getRequestContextWithPrefix('prefix.foo.bar')).to.be.eql({
+ requestContext: undefined,
+ dependentService: 'bar',
+ contextCommand: 'foo'
+ });
+ });
+ it("STOP all services command", function() {
+ expect(controller.getRequestContextWithPrefix('prefix.STOP.ALL_SERVICES')).to.be.eql({
+ requestContext: Em.I18n.t("requestInfo.stop").format(Em.I18n.t('common.allServices')),
+ dependentService: 'ALL_SERVICES',
+ contextCommand: 'STOP'
+ });
+ });
+ it("STOP one service command", function() {
+ expect(controller.getRequestContextWithPrefix('prefix.STOP.S1')).to.be.eql({
+ requestContext: Em.I18n.t("requestInfo.stop").format('S1'),
+ dependentService: 'S1',
+ contextCommand: 'STOP'
+ });
+ });
+ it("ROLLING-RESTART service command", function() {
+ expect(controller.getRequestContextWithPrefix('prefix.ROLLING-RESTART.S1.foo.bar')).to.be.eql({
+ requestContext: Em.I18n.t("rollingrestart.rest.context").format('S1', 'foo', 'bar'),
+ dependentService: 'S1',
+ contextCommand: 'ROLLING-RESTART'
+ });
+ });
+ });
+
+ describe("#showPopup()", function () {
+
+ beforeEach(function() {
+ sinon.stub(App.router, 'get').returns({
+ dataLoading: function() {
+ return {
+ done: Em.clb
+ }
+ }
+ });
+ sinon.stub(App.HostPopup, 'initPopup').returns(Em.Object.create());
+ App.HostPopup.set('isBackgroundOperations', true);
+ });
+
+ afterEach(function() {
+ App.router.get.restore();
+ App.HostPopup.initPopup.restore();
+ });
+
+ it("App.updater.immediateRun should be called", function() {
+ controller.showPopup();
+ expect(App.updater.immediateRun.calledWith('requestMostRecent')).to.be.true;
+ });
+
+ it("popupView should be created and opened", function() {
+ controller.set('popupView', null);
+ controller.showPopup();
+ expect(controller.get('popupView')).to.be.eql(Em.Object.create({
+ isNotShowBgChecked: true
+ }));
+ });
+
+ it("popupView should be restored and opened", function() {
+ controller.set('popupView', Em.Object.create());
+ controller.showPopup();
+ expect(controller.get('popupView')).to.be.eql(Em.Object.create({
+ isNotShowBgChecked: true,
+ isOpen: true
+ }));
+ });
+ });
+
+ describe("#clear()", function () {
+
+ it("operationsCount should be 10", function() {
+ controller.clear();
+ expect(controller.get('operationsCount')).to.be.equal(10);
+ });
+ });
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/98a83c5f/ambari-web/test/controllers/global/cluster_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/global/cluster_controller_test.js b/ambari-web/test/controllers/global/cluster_controller_test.js
index 47708ac..ad6e6f9 100644
--- a/ambari-web/test/controllers/global/cluster_controller_test.js
+++ b/ambari-web/test/controllers/global/cluster_controller_test.js
@@ -571,4 +571,596 @@ describe('App.clusterController', function () {
});
});
+
+ describe('#loadClientServerClockDistance()', function() {
+
+ beforeEach(function() {
+ sinon.stub(controller, 'getServerClock').returns({
+ done: Em.clb
+ });
+ });
+
+ afterEach(function() {
+ controller.getServerClock.restore();
+ });
+
+ it('getServerClock should be called', function() {
+ expect(controller.loadClientServerClockDistance()).to.be.an.object;
+ expect(controller.getServerClock).to.be.calledOnce;
+ });
+ });
+
+ describe('#getServerClock()', function() {
+
+ it('App.ajax.send should be called', function() {
+ controller.getServerClock();
+ var args = testHelpers.findAjaxRequest('name', 'ambari.service');
+ expect(args[0]).to.eql({
+ name: 'ambari.service',
+ sender: controller,
+ data: {
+ fields: '?fields=RootServiceComponents/server_clock'
+ },
+ success: 'getServerClockSuccessCallback',
+ error: 'getServerClockErrorCallback'
+ });
+ });
+ });
+
+ describe('#isRunningState()', function() {
+ var testCases = [
+ {
+ status: '',
+ expected: true
+ },
+ {
+ status: 'IN_PROGRESS',
+ expected: true
+ },
+ {
+ status: 'PENDING',
+ expected: true
+ },
+ {
+ status: 'FAILED_HOLDING',
+ expected: true
+ },
+ {
+ status: 'ABORTED',
+ expected: false
+ }
+ ];
+
+ testCases.forEach(function(test) {
+ it('status = ' + test.status, function() {
+ expect(controller.isRunningState(test.status)).to.be.equal(test.expected);
+ });
+ });
+ });
+
+ describe('#isSuspendedState()', function() {
+
+ it('should return true when status is ABORTED', function() {
+ expect(controller.isSuspendedState('ABORTED')).to.be.true;
+ });
+ });
+
+ describe('#loadRootService()', function() {
+
+ it('App.ajax.send should be called', function() {
+ controller.loadRootService();
+ var args = testHelpers.findAjaxRequest('name', 'service.ambari');
+ expect(args).to.exist;
+ });
+ });
+
+ describe('#requestHosts()', function() {
+
+ beforeEach(function() {
+ sinon.stub(App.HttpClient, 'get');
+ });
+
+ afterEach(function() {
+ App.HttpClient.get.restore();
+ });
+
+ it('App.HttpClient.get should be called', function() {
+ controller.requestHosts();
+ expect(App.HttpClient.get).to.be.calledOnce;
+ });
+ });
+
+ describe('#loadStackServiceComponents()', function() {
+
+ it('App.ajax.send should be called', function() {
+ controller.loadStackServiceComponents();
+ var args = testHelpers.findAjaxRequest('name', 'wizard.service_components');
+ expect(args).to.exist;
+ });
+ });
+
+ describe('#loadAmbariProperties()', function() {
+
+ it('App.ajax.send should be called', function() {
+ controller.loadAmbariProperties();
+ var args = testHelpers.findAjaxRequest('name', 'ambari.service');
+ expect(args).to.exist;
+ });
+ });
+
+ describe('#loadAuthorizations()', function() {
+
+ it('App.ajax.send should be called', function() {
+ controller.loadAuthorizations();
+ var args = testHelpers.findAjaxRequest('name', 'router.user.authorizations');
+ expect(args).to.exist;
+ });
+ });
+
+ describe('#loadAuthorizationsSuccessCallback()', function() {
+ var auth = App.get('auth');
+
+ beforeEach(function() {
+ sinon.stub(App.db, 'setAuth');
+ });
+
+ afterEach(function() {
+ App.db.setAuth.restore();
+ App.set('auth', auth);
+ });
+
+ it('App.db.setAuth should not be called when response is null', function() {
+ controller.loadAuthorizationsSuccessCallback(null);
+ expect(App.db.setAuth).to.not.be.called;
+ });
+
+ it('App.db.setAuth should not be called when response has no items', function() {
+ controller.loadAuthorizationsSuccessCallback({items: null});
+ expect(App.db.setAuth).to.not.be.called;
+ });
+
+ it('App.db.setAuth should be called when response correct', function() {
+ controller.loadAuthorizationsSuccessCallback({items: [
+ {
+ AuthorizationInfo: {
+ authorization_id: 'admin'
+ }
+ },
+ {
+ AuthorizationInfo: {
+ authorization_id: 'admin'
+ }
+ }
+ ]});
+ expect(App.get('auth')).to.be.eql(['admin']);
+ expect(App.db.setAuth.calledWith(['admin'])).to.be.true;
+ });
+ });
+
+ describe('#loadAmbariPropertiesSuccess()', function() {
+
+ beforeEach(function() {
+ sinon.stub(App.router.get('mainController'), 'monitorInactivity');
+ controller.loadAmbariPropertiesSuccess({
+ RootServiceComponents: {
+ properties: {
+ p1: '1'
+ }
+ }
+ });
+ });
+
+ afterEach(function() {
+ App.router.get('mainController').monitorInactivity.restore();
+ });
+
+ it('should set ambariProperties', function() {
+ expect(controller.get('ambariProperties')).to.be.eql({p1: '1'});
+ });
+
+ it('should set isCustomJDK', function() {
+ expect(controller.get('isCustomJDK')).to.be.true;
+ });
+
+ it('monitorInactivity should be called', function() {
+ expect(App.router.get('mainController').monitorInactivity).to.be.calledOnce;
+ });
+ });
+
+ describe('#updateClusterData()', function() {
+
+ beforeEach(function() {
+ sinon.stub(App.HttpClient, 'get');
+ });
+
+ afterEach(function() {
+ App.HttpClient.get.restore();
+ });
+
+ it('App.HttpClient.get should be called', function() {
+ controller.updateClusterData();
+ expect(App.HttpClient.get).to.be.calledOnce;
+ });
+ });
+
+ describe('#getAllHostNames()', function() {
+
+ it('App.ajax.send should be called', function() {
+ controller.getAllHostNames();
+ var args = testHelpers.findAjaxRequest('name', 'hosts.all');
+ expect(args).to.exist;
+ });
+ });
+
+ describe('#getHostNamesSuccess()', function() {
+
+ it('should set allHostNames', function() {
+ controller.getHostNamesSuccess({
+ items: [
+ {
+ Hosts: {
+ host_name: 'host1'
+ }
+ }
+ ]
+ });
+ expect(App.get('allHostNames')).to.be.eql(['host1']);
+ });
+ });
+
+ describe('#createKerberosAdminSession()', function() {
+
+ beforeEach(function() {
+ sinon.stub(credentialUtils, 'createOrUpdateCredentials').returns({
+ then: Em.clb
+ });
+ });
+
+ afterEach(function() {
+ credentialUtils.createOrUpdateCredentials.restore();
+ });
+
+ it('credentialUtils.createOrUpdateCredentials should be called', function() {
+ controller.createKerberosAdminSession({}, {});
+ expect(credentialUtils.createOrUpdateCredentials).to.be.calledOnce;
+ });
+ });
+
+ describe('#getAllUpgrades()', function() {
+
+ it('App.ajax.send should be called', function() {
+ controller.getAllUpgrades();
+ var args = testHelpers.findAjaxRequest('name', 'cluster.load_last_upgrade');
+ expect(args).to.exist;
+ });
+ });
+
+ describe('#triggerQuickLinksUpdate()', function() {
+
+ it('should increment quickLinksUpdateCounter', function() {
+ controller.set('quickLinksUpdateCounter', 0);
+ controller.triggerQuickLinksUpdate();
+ expect(controller.get('quickLinksUpdateCounter')).to.be.equal(1);
+ });
+ });
+
+ describe('#loadClusterData()', function() {
+
+ beforeEach(function() {
+ sinon.stub(controller, 'loadAuthorizations');
+ sinon.stub(controller, 'getAllHostNames');
+ sinon.stub(controller, 'loadAmbariProperties');
+ sinon.stub(controller, 'loadClusterInfo');
+ sinon.stub(controller, 'restoreUpgradeState');
+ sinon.stub(controller, 'loadClusterDataToModel');
+ sinon.stub(App.router.get('mainController'), 'startPolling');
+ sinon.stub(App.router.get('userSettingsController'), 'getAllUserSettings');
+ sinon.stub(App.router.get('errorsHandlerController'), 'loadErrorLogs');
+ sinon.stub(App.router.get('mainHostController'), 'updateStatusCounters');
+ sinon.stub(App.router.get('wizardWatcherController'), 'getUser');
+ sinon.stub(App.db, 'setFilterConditions');
+ sinon.stub(App.router.get('updateController'), 'updateClusterEnv');
+ controller.set('isLoaded', false);
+ });
+
+ afterEach(function() {
+ App.router.get('updateController').updateClusterEnv.restore();
+ App.db.setFilterConditions.restore();
+ App.router.get('wizardWatcherController').getUser.restore();
+ App.router.get('mainHostController').updateStatusCounters.restore();
+ App.router.get('errorsHandlerController').loadErrorLogs.restore();
+ App.router.get('userSettingsController').getAllUserSettings.restore();
+ App.router.get('mainController').startPolling.restore();
+ controller.loadAuthorizations.restore();
+ controller.getAllHostNames.restore();
+ controller.loadAmbariProperties.restore();
+ controller.loadClusterInfo.restore();
+ controller.restoreUpgradeState.restore();
+ controller.loadClusterDataToModel.restore();
+ });
+
+ it('loadAuthorizations should be called', function() {
+ controller.loadClusterData();
+ expect(controller.loadAuthorizations.calledOnce).to.be.true;
+ });
+
+ it('getAllHostNames should be called', function() {
+ controller.loadClusterData();
+ expect(controller.getAllHostNames.calledOnce).to.be.true;
+ });
+
+ it('loadAmbariProperties should be called', function() {
+ controller.loadClusterData();
+ expect(controller.loadAmbariProperties.calledOnce).to.be.true;
+ });
+
+ it('getAllUserSettings should be called', function() {
+ controller.loadClusterData();
+ expect(App.router.get('userSettingsController').getAllUserSettings.calledOnce).to.be.true;
+ });
+
+ it('loadErrorLogs should be called', function() {
+ controller.loadClusterData();
+ expect(App.router.get('errorsHandlerController').loadErrorLogs.calledOnce).to.be.true;
+ });
+
+ it('updateStatusCounters should be called', function() {
+ controller.loadClusterData();
+ expect(App.router.get('mainHostController').updateStatusCounters.calledOnce).to.be.true;
+ });
+
+ it('loadClusterInfo should be called', function() {
+ controller.loadClusterData();
+ expect(controller.loadClusterInfo.calledOnce).to.be.true;
+ });
+
+ it('restoreUpgradeState should be called', function() {
+ controller.loadClusterData();
+ expect(controller.restoreUpgradeState.calledOnce).to.be.true;
+ });
+
+ it('getUser should be called', function() {
+ controller.loadClusterData();
+ expect(App.router.get('wizardWatcherController').getUser.calledOnce).to.be.true;
+ });
+
+ it('App.db.setFilterConditions should be called', function() {
+ controller.loadClusterData();
+ expect(App.db.setFilterConditions.calledOnce).to.be.true;
+ });
+
+ it('loadClusterDataToModel should be called', function() {
+ controller.loadClusterData();
+ expect(controller.loadClusterDataToModel.calledOnce).to.be.true;
+ });
+
+ it('updateClusterEnv should be called', function() {
+ controller.loadClusterData();
+ expect(App.router.get('updateController').updateClusterEnv.calledOnce).to.be.true;
+ });
+
+ it('startPolling should be called', function() {
+ controller.set('isLoaded', true);
+ controller.loadClusterData();
+ expect(App.router.get('mainController').startPolling.calledOnce).to.be.true;
+ });
+ });
+
+ describe('#loadClusterInfo()', function() {
+
+ beforeEach(function() {
+ sinon.stub(App.HttpClient, 'get');
+ });
+
+ afterEach(function() {
+ App.HttpClient.get.restore();
+ });
+
+ it('App.HttpClient.get should be called', function() {
+ controller.loadClusterInfo();
+ expect(App.HttpClient.get.calledOnce).to.be.true;
+ });
+ });
+
+ describe('#loadClusterDataToModel()', function() {
+
+ beforeEach(function() {
+ sinon.stub(controller, 'loadStackServiceComponents', function(callback) {
+ callback({items: [{
+ StackServices: {}
+ }]});
+ });
+ sinon.stub(App.stackServiceMapper, 'mapStackServices');
+ sinon.stub(App.config, 'setPreDefinedServiceConfigs');
+ sinon.stub(controller, 'updateLoadStatus');
+ sinon.stub(controller, 'loadServicesAndComponents');
+ controller.loadClusterDataToModel();
+ });
+
+ afterEach(function() {
+ controller.loadServicesAndComponents.restore();
+ controller.updateLoadStatus.restore();
+ controller.loadStackServiceComponents.restore();
+ App.stackServiceMapper.mapStackServices.restore();
+ App.config.setPreDefinedServiceConfigs.restore();
+ });
+
+ it('loadStackServiceComponents should be called', function() {
+ expect(controller.loadStackServiceComponents.calledOnce).to.be.true;
+ });
+
+ it('App.stackServiceMapper.mapStackServices should be called', function() {
+ expect(App.stackServiceMapper.mapStackServices.calledWith({items: [
+ {
+ StackServices: {
+ is_selected: true,
+ is_installed: false
+ }
+ }
+ ]})).to.be.true;
+ });
+
+ it('App.config.setPreDefinedServiceConfigs should be called', function() {
+ expect(App.config.setPreDefinedServiceConfigs.calledWith(true)).to.be.true;
+ });
+
+ it('updateLoadStatus should be called', function() {
+ expect(controller.updateLoadStatus.calledWith('stackComponents')).to.be.true;
+ });
+
+ it('loadServicesAndComponents should be called', function() {
+ expect(controller.loadServicesAndComponents.calledOnce).to.be.true;
+ });
+ });
+
+ describe('#loadAlerts()', function() {
+ var updater = App.router.get('updateController');
+
+ beforeEach(function() {
+ sinon.stub(updater, 'updateAlertGroups', Em.clb);
+ sinon.stub(updater, 'updateAlertDefinitions', Em.clb);
+ sinon.stub(updater, 'updateAlertDefinitionSummary', Em.clb);
+ sinon.stub(updater, 'updateUnhealthyAlertInstances', Em.clb);
+ controller.loadAlerts();
+ });
+
+ afterEach(function() {
+ updater.updateUnhealthyAlertInstances.restore();
+ updater.updateAlertDefinitionSummary.restore();
+ updater.updateAlertDefinitions.restore();
+ updater.updateAlertGroups.restore();
+ });
+
+ it('updateAlertGroups should be called', function() {
+ expect(updater.updateAlertGroups.calledOnce).to.be.true;
+ });
+
+ it('updateAlertDefinitions should be called', function() {
+ expect(updater.updateAlertDefinitions.calledOnce).to.be.true;
+ });
+
+ it('updateAlertDefinitionSummary should be called', function() {
+ expect(updater.updateAlertDefinitionSummary.calledOnce).to.be.true;
+ });
+
+ it('updateUnhealthyAlertInstances should be called', function() {
+ expect(updater.updateUnhealthyAlertInstances.calledOnce).to.be.true;
+ });
+
+ it('should set isAlertsLoaded to true', function() {
+ expect(controller.get('isAlertsLoaded')).to.be.true;
+ });
+ });
+
+ describe('#loadConfigProperties()', function() {
+
+ beforeEach(function() {
+ sinon.stub(App.config, 'loadConfigsFromStack').returns({
+ complete: Em.clb
+ });
+ sinon.stub(App.config, 'loadClusterConfigsFromStack').returns({
+ complete: Em.clb
+ });
+ });
+
+ afterEach(function() {
+ App.config.loadClusterConfigsFromStack.restore();
+ App.config.loadConfigsFromStack.restore();
+ });
+
+ it('App.config.loadConfigsFromStack should be called', function() {
+ controller.loadConfigProperties();
+ expect(App.config.loadConfigsFromStack.calledOnce).to.be.true;
+ });
+
+ it('App.config.loadClusterConfigsFromStack should be called', function() {
+ controller.loadConfigProperties();
+ expect(App.config.loadClusterConfigsFromStack.calledOnce).to.be.true;
+ });
+
+ it('isConfigsPropertiesLoaded should be true', function() {
+ controller.loadConfigProperties();
+ expect(controller.get('isConfigsPropertiesLoaded')).to.be.true;
+ });
+ });
+
+ describe('#loadServicesAndComponents()', function() {
+ var updater = App.router.get('updateController');
+
+ beforeEach(function() {
+ sinon.stub(updater, 'updateServices', Em.clb);
+ sinon.stub(controller, 'updateLoadStatus');
+ sinon.stub(updater, 'updateHost', Em.clb);
+ sinon.stub(controller, 'loadAlerts');
+ sinon.stub(controller, 'loadConfigProperties');
+ sinon.stub(updater, 'updateComponentsState', Em.clb);
+ sinon.stub(updater, 'updateServiceMetric', Em.clb);
+ sinon.stub(updater, 'updateComponentConfig', Em.clb);
+
+ controller.loadServicesAndComponents();
+ });
+
+ afterEach(function() {
+ controller.loadConfigProperties.restore();
+ controller.loadAlerts.restore();
+ updater.updateHost.restore();
+ updater.updateServices.restore();
+ controller.updateLoadStatus.restore();
+ updater.updateComponentsState.restore();
+ updater.updateServiceMetric.restore();
+ updater.updateComponentConfig.restore();
+ });
+
+ it('updateServices should be called', function() {
+ expect(updater.updateServices.calledOnce).to.be.true;
+ });
+
+ it('updateLoadStatus should be called', function() {
+ expect(controller.updateLoadStatus.calledWith('services')).to.be.true;
+ });
+
+ it('updateHost should be called', function() {
+ expect(updater.updateHost.calledOnce).to.be.true;
+ });
+
+ it('isHostsLoaded should be true', function() {
+ expect(controller.get('isHostsLoaded')).to.be.true;
+ });
+
+ it('loadAlerts should be called', function() {
+ expect(controller.loadAlerts.calledOnce).to.be.true;
+ });
+
+ it('loadConfigProperties should be called', function() {
+ expect(controller.loadConfigProperties.calledOnce).to.be.true;
+ });
+
+ it('updateComponentsState should be called', function() {
+ expect(updater.updateComponentsState.calledOnce).to.be.true;
+ });
+
+ it('isComponentsStateLoaded should be true', function() {
+ expect(controller.get('isComponentsStateLoaded')).to.be.true;
+ });
+
+ it('updateServiceMetric should be called', function() {
+ expect(updater.updateServiceMetric.calledTwice).to.be.true;
+ });
+
+ it('isServiceMetricsLoaded should be true', function() {
+ expect(controller.get('isServiceMetricsLoaded')).to.be.true;
+ });
+
+ it('isHostComponentMetricsLoaded should be true', function() {
+ expect(controller.get('isHostComponentMetricsLoaded')).to.be.true;
+ });
+
+ it('updateComponentConfig should be called', function() {
+ expect(updater.updateComponentConfig.calledOnce).to.be.true;
+ });
+
+ it('isComponentsConfigLoaded should be true', function() {
+ expect(controller.get('isComponentsConfigLoaded')).to.be.true;
+ });
+ });
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/98a83c5f/ambari-web/test/controllers/global/configuration_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/global/configuration_controller_test.js b/ambari-web/test/controllers/global/configuration_controller_test.js
index 5baac0e..11dfe0d 100644
--- a/ambari-web/test/controllers/global/configuration_controller_test.js
+++ b/ambari-web/test/controllers/global/configuration_controller_test.js
@@ -19,6 +19,7 @@
var App = require('app');
require('controllers/global/configuration_controller');
+var testHelpers = require('test/helpers');
describe('App.ConfigurationController', function () {
@@ -131,4 +132,166 @@ describe('App.ConfigurationController', function () {
});
});
});
+
+ describe('#getConfigsByTags()', function() {
+
+ beforeEach(function() {
+ sinon.stub(App.db, 'getConfigs').returns([
+ {
+ type: 't1',
+ tag: 'tag1'
+ }
+ ]);
+ this.mockCheck = sinon.stub(controller, 'checkTagsChanges');
+ sinon.stub(controller, 'loadFromServer');
+ sinon.stub(controller, 'loadFromDB');
+ });
+
+ afterEach(function() {
+ App.db.getConfigs.restore();
+ this.mockCheck.restore();
+ controller.loadFromServer.restore();
+ controller.loadFromDB.restore();
+ });
+
+ it('checkTagsChanges should be called', function() {
+ controller.getConfigsByTags([]);
+ expect(controller.checkTagsChanges.calledWith([], [{
+ siteName: 't1',
+ tagName: 'tag1'
+ }])).to.be.true;
+ });
+
+ it('loadFromServer should be called', function() {
+ this.mockCheck.returns(true);
+ controller.getConfigsByTags([]);
+ expect(controller.loadFromServer.calledWith([])).to.be.true;
+ });
+
+ it('loadFromDB should be called', function() {
+ this.mockCheck.returns(false);
+ controller.getConfigsByTags([{siteName: 'site1'}]);
+ expect(controller.loadFromDB.calledWith(['site1'])).to.be.true;
+ });
+ });
+
+ describe('#loadFromServer()', function() {
+
+ beforeEach(function() {
+ sinon.stub(controller, 'loadConfigTags').returns({
+ done: function(callback) {
+ callback({
+ Clusters: {
+ desired_configs: {
+ 's1': {
+ siteName: 's1',
+ tag: 'tag2'
+ }
+ }
+ }
+ });
+ }
+ });
+ sinon.stub(controller, 'loadConfigsByTags');
+ });
+
+ afterEach(function() {
+ controller.loadConfigTags.restore();
+ controller.loadConfigsByTags.restore();
+ });
+
+ it('tags data is correct', function() {
+ expect(controller.loadFromServer([{tagName: 'tag1', siteName: 's1'}])).to.be.an.object;
+ expect(controller.loadConfigsByTags.calledWith([{tagName: 'tag1', siteName: 's1'}])).to.be.true;
+ });
+
+ it('tags data is corrupted', function() {
+ expect(controller.loadFromServer([{siteName: 's1'}])).to.be.an.object;
+ expect(controller.loadConfigsByTags.calledWith([{tagName: 'tag2', siteName: 's1'}])).to.be.true;
+ });
+ });
+
+ describe('#loadConfigsByTags()', function() {
+ var dfd = {
+ resolve: Em.K
+ };
+
+ beforeEach(function() {
+ sinon.stub(App.config, 'loadConfigsByTags').returns({
+ done: function(callback) {
+ callback({items: [{}]});
+ return {
+ complete: Em.clb
+ }
+ }
+ });
+ sinon.stub(controller, 'saveToDB');
+ sinon.spy(dfd, 'resolve');
+ controller.loadConfigsByTags([], dfd);
+ });
+
+ afterEach(function() {
+ App.config.loadConfigsByTags.restore();
+ controller.saveToDB.restore();
+ dfd.resolve.restore();
+ });
+
+ it('saveToDB should be called', function() {
+ expect(controller.saveToDB.calledWith([{}])).to.be.true;
+ });
+
+ it('Deferred should be resolved', function() {
+ expect(dfd.resolve.calledWith([{}])).to.be.true;
+ });
+ });
+
+ describe('#loadConfigTags()', function() {
+
+ it('App.ajax.send should be called', function() {
+ controller.loadConfigTags();
+ var args = testHelpers.findAjaxRequest('name', 'config.tags');
+ expect(args).to.exist;
+ });
+ });
+
+ describe('#saveToDB()', function() {
+
+ beforeEach(function() {
+ sinon.stub(App.db, 'getConfigs').returns([{
+ type: 't1'
+ }]);
+ sinon.stub(App.db, 'setConfigs');
+ });
+
+ afterEach(function() {
+ App.db.getConfigs.restore();
+ App.db.setConfigs.restore();
+ });
+
+ it('App.db.setConfigs should be called', function() {
+ var loadedConfigs = [
+ {
+ type: 't1',
+ tag: 'tag1',
+ properties: {},
+ properties_attributes: {}
+ },
+ {
+ type: 't2'
+ }
+ ];
+ controller.saveToDB(loadedConfigs);
+ expect(JSON.stringify(App.db.setConfigs.getCall(0).args[0])).to.be.equal(JSON.stringify([
+ {
+ type: 't1',
+ tag: 'tag1',
+ properties: {},
+ properties_attributes: {}
+ },
+ {
+ type: 't2'
+ }
+ ]));
+ });
+ });
});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/98a83c5f/ambari-web/test/controllers/global/errors_handler_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/global/errors_handler_controller_test.js b/ambari-web/test/controllers/global/errors_handler_controller_test.js
index 2a726ee..aa98d09 100644
--- a/ambari-web/test/controllers/global/errors_handler_controller_test.js
+++ b/ambari-web/test/controllers/global/errors_handler_controller_test.js
@@ -67,4 +67,14 @@ describe('App.ErrorsHandlerController', function () {
expect(args[0]).to.be.equal('errors');
});
});
+
+ describe("#getUserPrefSuccessCallback()", function () {
+
+ it("should set errors to localStorage", function() {
+ controller.getUserPrefSuccessCallback({data: {}});
+ expect(localStorage.getObject('errors')).to.be.eql({
+ data: {}
+ })
+ });
+ });
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/98a83c5f/ambari-web/test/controllers/global/update_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/global/update_controller_test.js b/ambari-web/test/controllers/global/update_controller_test.js
index dc57a57..2a9d020 100644
--- a/ambari-web/test/controllers/global/update_controller_test.js
+++ b/ambari-web/test/controllers/global/update_controller_test.js
@@ -32,6 +32,11 @@ describe('App.UpdateController', function () {
beforeEach(function () {
c = App.UpdateController.create();
+ sinon.stub(App.HttpClient, 'get');
+ });
+
+ afterEach(function() {
+ App.HttpClient.get.restore();
});
App.TestAliases.testAsComputedAlias(App.UpdateController.create(), 'clusterName', 'App.router.clusterController.clusterName', 'string');
@@ -443,6 +448,14 @@ describe('App.UpdateController', function () {
describe('#computeParameters', function () {
+ beforeEach(function() {
+ sinon.stub(App.router.get('mainHostComboSearchBoxController'), 'generateQueryParam').returns('combo');
+ });
+
+ afterEach(function() {
+ App.router.get('mainHostComboSearchBoxController').generateQueryParam.restore();
+ });
+
Em.A([
{
q: [{
@@ -454,6 +467,22 @@ describe('App.UpdateController', function () {
},
{
q: [{
+ type: 'CUSTOM',
+ key: '{0} - {1}',
+ value: [1, 2]
+ }],
+ result: '1 - 2'
+ },
+ {
+ q: [{
+ type: 'COMBO',
+ key: '',
+ value: []
+ }],
+ result: 'combo'
+ },
+ {
+ q: [{
type: 'MULTIPLE',
key: 'k',
value: [1, 2]
@@ -534,9 +563,102 @@ describe('App.UpdateController', function () {
var result = c.computeParameters(test.q);
expect(result).to.be.equal(test.result);
});
+ });
+ });
+
+ describe('#preLoadHosts()', function() {
+
+ beforeEach(function() {
+ sinon.stub(c, 'getHostByHostComponents');
+ });
+
+ afterEach(function() {
+ c.getHostByHostComponents.restore();
+ });
+
+ it('getHostByHostComponents should be called', function() {
+ c.set('queryParams.Hosts', [{isComponentRelatedFilter: true}]);
+ expect(c.preLoadHosts(Em.K)).to.be.true;
+ expect(c.getHostByHostComponents.calledOnce).to.be.true;
+ });
+
+ it('getHostByHostComponents should not be called', function() {
+ c.set('queryParams.Hosts', []);
+ expect(c.preLoadHosts(Em.K)).to.be.false;
+ expect(c.getHostByHostComponents.calledOnce).to.be.false;
+ });
+ });
+
+ describe('#getHostByHostComponents', function() {
+ it('App.ajax.send should be called', function() {
+ var args = testHelpers.findAjaxRequest('name', 'hosts.host_components.pre_load');
+ expect(args).to.exists;
+ });
+ });
+
+ describe('#updateServices()', function() {
+ it('App.HttpClient.get should be called', function() {
+ c.updateServices();
+ expect(App.HttpClient.get.calledOnce).to.be.true;
+ });
+ });
+
+ describe('#updateComponentConfig()', function() {
+ it('App.HttpClient.get should be called', function() {
+ c.updateComponentConfig();
+ expect(App.HttpClient.get.calledOnce).to.be.true;
+ });
+ });
+
+ describe('#updateComponentsState()', function() {
+ it('App.HttpClient.get should be called', function() {
+ c.updateComponentsState();
+ expect(App.HttpClient.get.calledOnce).to.be.true;
+ });
+ });
+
+ describe('#updateAlertDefinitions()', function() {
+ it('App.HttpClient.get should be called', function() {
+ c.updateAlertDefinitions();
+ expect(App.HttpClient.get.calledOnce).to.be.true;
+ });
+ });
+
+ describe('#updateUnhealthyAlertInstances()', function() {
+ it('App.HttpClient.get should be called', function() {
+ c.updateUnhealthyAlertInstances();
+ expect(App.HttpClient.get.calledOnce).to.be.true;
+ });
+ });
+
+ describe('#updateAlertDefinitionSummary()', function() {
+ it('App.HttpClient.get should be called', function() {
+ c.updateAlertDefinitionSummary();
+ expect(App.HttpClient.get.calledOnce).to.be.true;
+ });
+ });
+
+ describe('#updateAlertGroups()', function() {
+ it('App.HttpClient.get should be called', function() {
+ c.updateAlertGroups();
+ expect(App.HttpClient.get.calledOnce).to.be.true;
});
+ });
+ describe('#updateAlertNotifications()', function() {
+ it('App.HttpClient.get should be called', function() {
+ c.updateAlertNotifications();
+ expect(App.HttpClient.get.calledOnce).to.be.true;
+ });
});
+ describe('#loadClusterConfig()', function() {
+
+ it('App.ajax.send should be called', function() {
+ c.loadClusterConfig();
+ var args = testHelpers.findAjaxRequest('name', 'config.tags.site');
+ expect(args).to.exists;
+ });
+ });
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/98a83c5f/ambari-web/test/controllers/global/user_settings_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/global/user_settings_controller_test.js b/ambari-web/test/controllers/global/user_settings_controller_test.js
index 5ae17f8..f68c109 100644
--- a/ambari-web/test/controllers/global/user_settings_controller_test.js
+++ b/ambari-web/test/controllers/global/user_settings_controller_test.js
@@ -17,6 +17,7 @@
*/
var App = require('app');
+var testHelpers = require('test/helpers');
describe('App.UserSettingsController', function () {
var controller;
@@ -58,4 +59,303 @@ describe('App.UserSettingsController', function () {
});
});
+ describe("#dataLoading()", function () {
+
+ beforeEach(function() {
+ sinon.stub(controller, 'getUserPref').returns({
+ complete: Em.clb
+ });
+ });
+
+ afterEach(function() {
+ controller.getUserPref.restore();
+ });
+
+ it("should return promise with preferences", function() {
+ controller.set('currentPrefObject', {data: {}});
+ var promise = controller.dataLoading();
+ promise.done(function(result) {
+ expect(result).to.be.eql({data: {}});
+ });
+ expect(controller.get('currentPrefObject')).to.be.null;
+ });
+ });
+
+ describe("#getUserPrefErrorCallback()", function () {
+
+ beforeEach(function() {
+ sinon.stub(controller, 'updateUserPrefWithDefaultValues');
+ });
+
+ afterEach(function() {
+ controller.updateUserPrefWithDefaultValues.restore();
+ });
+
+ it("updateUserPrefWithDefaultValues should be called", function() {
+ controller.getUserPrefErrorCallback({status: 404});
+ expect(controller.updateUserPrefWithDefaultValues.calledOnce).to.be.true;
+ });
+
+ it("updateUserPrefWithDefaultValues should not be called", function() {
+ controller.getUserPrefErrorCallback({status: 200});
+ expect(controller.updateUserPrefWithDefaultValues.called).to.be.false;
+ });
+ });
+
+ describe("#getAllUserSettings()", function () {
+
+ beforeEach(function() {
+ sinon.stub(controller, 'dataLoading').returns({
+ done: function(callback) {
+ callback({});
+ }
+ });
+ sinon.stub(controller, 'postUserPref');
+ controller.reopen({
+ userSettingsKeys: {
+ key1: {
+ defaultValue: 'val'
+ }
+ }
+ });
+ controller.getAllUserSettings();
+ });
+
+ afterEach(function() {
+ controller.dataLoading.restore();
+ controller.postUserPref.restore();
+ });
+
+ it("postUserPref should be called", function() {
+ expect(controller.postUserPref.calledWith('key1', 'val')).to.be.true;
+ });
+
+ it("userSettings should be set", function() {
+ expect(controller.get('userSettings')).to.be.eql({key1: 'val'});
+ });
+ });
+
+ describe('#updateUserPrefWithDefaultValues()', function() {
+
+ beforeEach(function() {
+ sinon.stub(controller, 'postUserPref');
+ controller.reopen({
+ userSettingsKeys: {
+ key1: {
+ name: 'n1',
+ defaultValue: 'val'
+ }
+ }
+ });
+ });
+
+ afterEach(function() {
+ controller.postUserPref.restore();
+ });
+
+ it('postUserPref should be called', function() {
+ controller.updateUserPrefWithDefaultValues({}, true);
+ expect(controller.postUserPref.calledWith('key1', 'val')).to.be.true;
+ });
+ });
+
+ describe('#showSettingsPopup()', function() {
+
+ beforeEach(function() {
+ this.mockAuthorized = sinon.stub(App, 'isAuthorized');
+ sinon.stub(controller, 'dataLoading').returns({
+ done: Em.clb
+ });
+ sinon.stub(controller, 'loadPrivileges').returns({
+ complete: Em.clb
+ });
+ sinon.stub(controller, '_showSettingsPopup');
+ });
+
+ afterEach(function() {
+ controller.dataLoading.restore();
+ this.mockAuthorized.restore();
+ controller.loadPrivileges.restore();
+ controller._showSettingsPopup.restore();
+ });
+
+ it('dataLoading should not be called', function() {
+ this.mockAuthorized.returns(false);
+ controller.showSettingsPopup();
+ expect(controller.dataLoading).to.not.be.called;
+ });
+
+ it('_showSettingsPopup should be called', function() {
+ this.mockAuthorized.returns(true);
+ controller.showSettingsPopup();
+ expect(controller.dataLoading).to.be.calledOnce;
+ expect(controller.loadPrivileges).to.be.calledOnce;
+ expect(controller._showSettingsPopup).to.be.calledonce;
+ });
+ });
+
+ describe('#loadPrivileges()', function() {
+
+ beforeEach(function() {
+ sinon.stub(App.db, 'getLoginName').returns('user');
+ });
+
+ afterEach(function() {
+ App.db.getLoginName.restore();
+ });
+
+ it('App.ajax.send should be called', function() {
+ controller.loadPrivileges();
+ var args = testHelpers.findAjaxRequest('name', 'router.user.privileges');
+ expect(args[0]).to.be.eql({
+ name: 'router.user.privileges',
+ sender: controller,
+ data: {
+ userName: 'user'
+ },
+ success: 'loadPrivilegesSuccessCallback'
+ });
+ });
+ });
+
+ describe('#postUserPref()', function() {
+
+ it('short key', function() {
+ controller.postUserPref('key1', 'val1');
+ expect(controller.get('userSettings.key1')).to.be.equal('val1');
+ });
+
+ it('key with prefix', function() {
+ controller.postUserPref('userSettingsKeys.key2', 'val2');
+ expect(controller.get('userSettings.key2')).to.be.equal('val2');
+ });
+ });
+
+ describe('#loadPrivilegesSuccessCallback()', function() {
+
+ beforeEach(function() {
+ this.mock = sinon.stub(controller, 'parsePrivileges');
+ });
+
+ afterEach(function() {
+ this.mock.restore();
+ });
+
+ it('should set privilege info when data present', function() {
+ this.mock.returns({
+ clusters: {
+ 'c1': {}
+ },
+ views: {
+ 'v1': {
+ privileges: {},
+ version: 'ver1',
+ view_name: 'view1'
+ }
+ }
+ });
+ controller.loadPrivilegesSuccessCallback({items: [{}]});
+ expect(JSON.stringify(controller.get('privileges'))).to.be.equal(JSON.stringify({
+ clusters: [
+ {
+ name: 'c1',
+ privileges: {}
+ }
+ ],
+ views: [
+ {
+ instance_name: 'v1',
+ privileges: {},
+ version: 'ver1',
+ view_name: 'view1'
+ }
+ ]
+ }));
+ expect(controller.get('noClusterPriv')).to.be.false;
+ expect(controller.get('noViewPriv')).to.be.false;
+ expect(controller.get('hidePrivileges')).to.be.false;
+ });
+
+ it('should set privilege info when data is empty', function() {
+ this.mock.returns({
+ clusters: {},
+ views: {}
+ });
+ controller.loadPrivilegesSuccessCallback({items: []});
+ expect(controller.get('privileges')).to.be.null;
+ expect(controller.get('noClusterPriv')).to.be.true;
+ expect(controller.get('noViewPriv')).to.be.true;
+ expect(controller.get('hidePrivileges')).to.be.true;
+ });
+ });
+
+ describe('#parsePrivileges()', function() {
+
+ it('should parse privileges from data', function() {
+ var data = {
+ items: [
+ {
+ PrivilegeInfo: {
+ type: 'CLUSTER',
+ cluster_name: 'c1',
+ clusters: {},
+ permission_label: 'perm1'
+ }
+ },
+ {
+ PrivilegeInfo: {
+ type: 'VIEW',
+ instance_name: 'c1',
+ view_name: 'v1',
+ version: 'ver1',
+ views: {},
+ permission_label: 'perm1'
+ }
+ }
+ ]
+ };
+ expect(controller.parsePrivileges(data)).to.be.eql({
+ "clusters": {
+ "c1": [
+ "perm1"
+ ]
+ },
+ "views": {
+ "c1": {
+ "privileges": [
+ "perm1"
+ ],
+ "version": "ver1",
+ "view_name": "v1"
+ }
+ }
+ })
+ });
+ });
+
+ describe('#_showSettingsPopup()', function() {
+
+ beforeEach(function() {
+ sinon.stub(App.ModalPopup, 'show');
+ sinon.stub(App, 'showAlertPopup');
+ });
+
+ afterEach(function() {
+ App.ModalPopup.show.restore();
+ App.showAlertPopup.restore();
+ });
+
+ it('App.ModalPopup.show should be called', function() {
+ controller.set('userSettingsKeys', {show_bg: {name: 'n1'}});
+ controller._showSettingsPopup({n1: {}});
+ expect(App.ModalPopup.show).to.be.calledOnce;
+ });
+
+ it('App.showAlertPopup should be called', function() {
+ controller.set('userSettingsKeys', {show_bg: {name: 'n1'}});
+ controller._showSettingsPopup({});
+ expect(App.showAlertPopup).to.be.calledOnce;
+ });
+ });
+
});
\ No newline at end of file
[05/26] ambari git commit: AMBARI-19195. Add permission for Service
Auto Start (rlevas)
Posted by nc...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/d48b8d9b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
index 5e89039..24b4570 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
@@ -26,6 +26,8 @@ import com.google.inject.Injector;
import com.google.inject.Module;
import com.google.inject.Provider;
import junit.framework.Assert;
+
+import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.actionmanager.ActionManager;
import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.AmbariManagementController;
@@ -33,6 +35,12 @@ import org.apache.ambari.server.controller.AmbariManagementControllerImpl;
import org.apache.ambari.server.controller.KerberosHelper;
import org.apache.ambari.server.controller.MaintenanceStateHelper;
import org.apache.ambari.server.orm.DBAccessor;
+import org.apache.ambari.server.orm.dao.PermissionDAO;
+import org.apache.ambari.server.orm.dao.ResourceTypeDAO;
+import org.apache.ambari.server.orm.dao.RoleAuthorizationDAO;
+import org.apache.ambari.server.orm.entities.PermissionEntity;
+import org.apache.ambari.server.orm.entities.ResourceTypeEntity;
+import org.apache.ambari.server.orm.entities.RoleAuthorizationEntity;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.Config;
@@ -53,7 +61,10 @@ import javax.persistence.EntityManager;
import java.lang.reflect.Method;
import java.sql.Connection;
import java.sql.ResultSet;
+import java.sql.SQLException;
import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -259,6 +270,7 @@ public class UpgradeCatalog250Test {
Method updateHiveLlapConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateHiveLlapConfigs");
Method updateHIVEInteractiveConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateHIVEInteractiveConfigs");
Method updateTEZInteractiveConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateTEZInteractiveConfigs");
+ Method addManageServiceAutoStartPermissions = UpgradeCatalog250.class.getDeclaredMethod("addManageServiceAutoStartPermissions");
Method addNewConfigurationsFromXml = AbstractUpgradeCatalog.class.getDeclaredMethod("addNewConfigurationsFromXml");
Method updateTablesForZeppelinViewRemoval = UpgradeCatalog250.class.getDeclaredMethod("updateTablesForZeppelinViewRemoval");
Method updateAtlasConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateAtlasConfigs");
@@ -268,6 +280,7 @@ public class UpgradeCatalog250Test {
.addMockedMethod(updateKafkaConfigs)
.addMockedMethod(updateHiveLlapConfigs)
.addMockedMethod(addNewConfigurationsFromXml)
+ .addMockedMethod(addManageServiceAutoStartPermissions)
.addMockedMethod(updateHIVEInteractiveConfigs)
.addMockedMethod(updateTEZInteractiveConfigs)
.addMockedMethod(updateTablesForZeppelinViewRemoval)
@@ -298,6 +311,9 @@ public class UpgradeCatalog250Test {
upgradeCatalog250.updateAtlasConfigs();
expectLastCall().once();
+ upgradeCatalog250.addManageServiceAutoStartPermissions();
+ expectLastCall().once();
+
replay(upgradeCatalog250);
upgradeCatalog250.executeDMLUpdates();
@@ -498,4 +514,77 @@ public class UpgradeCatalog250Test {
Map<String, String> updatedProperties = propertiesCapture.getValue();
assertTrue(Maps.difference(newProperties, updatedProperties).areEqual());
}
+
+ @Test
+ public void testCreateRoleAuthorizations() throws AmbariException, SQLException {
+
+ EasyMockSupport easyMockSupport = new EasyMockSupport();
+
+ ResourceTypeEntity ambariResourceTypeEntity = easyMockSupport.createMock(ResourceTypeEntity.class);
+
+ ResourceTypeEntity clusterResourceTypeEntity = easyMockSupport.createMock(ResourceTypeEntity.class);
+
+ Collection<RoleAuthorizationEntity> ambariAdministratorAuthorizations = new ArrayList<RoleAuthorizationEntity>();
+ Collection<RoleAuthorizationEntity> clusterAdministratorAuthorizations = new ArrayList<RoleAuthorizationEntity>();
+
+ PermissionEntity clusterAdministratorPermissionEntity = easyMockSupport.createMock(PermissionEntity.class);
+ expect(clusterAdministratorPermissionEntity.getAuthorizations())
+ .andReturn(clusterAdministratorAuthorizations).atLeastOnce();
+
+ PermissionEntity ambariAdministratorPermissionEntity = easyMockSupport.createMock(PermissionEntity.class);
+ expect(ambariAdministratorPermissionEntity.getAuthorizations())
+ .andReturn(ambariAdministratorAuthorizations).atLeastOnce();
+
+ PermissionDAO permissionDAO = easyMockSupport.createMock(PermissionDAO.class);
+ expect(permissionDAO.findPermissionByNameAndType("AMBARI.ADMINISTRATOR", ambariResourceTypeEntity))
+ .andReturn(ambariAdministratorPermissionEntity).atLeastOnce();
+ expect(permissionDAO.findPermissionByNameAndType("CLUSTER.ADMINISTRATOR", clusterResourceTypeEntity))
+ .andReturn(clusterAdministratorPermissionEntity).atLeastOnce();
+ expect(permissionDAO.merge(ambariAdministratorPermissionEntity))
+ .andReturn(ambariAdministratorPermissionEntity).atLeastOnce();
+ expect(permissionDAO.merge(clusterAdministratorPermissionEntity))
+ .andReturn(clusterAdministratorPermissionEntity).atLeastOnce();
+
+ ResourceTypeDAO resourceTypeDAO = easyMockSupport.createMock(ResourceTypeDAO.class);
+ expect(resourceTypeDAO.findByName("AMBARI")).andReturn(ambariResourceTypeEntity).atLeastOnce();
+ expect(resourceTypeDAO.findByName("CLUSTER")).andReturn(clusterResourceTypeEntity).atLeastOnce();
+
+ RoleAuthorizationDAO roleAuthorizationDAO = easyMockSupport.createMock(RoleAuthorizationDAO.class);
+ expect(roleAuthorizationDAO.findById("CLUSTER.RUN_CUSTOM_COMMAND")).andReturn(null).atLeastOnce();
+ expect(roleAuthorizationDAO.findById("AMBARI.RUN_CUSTOM_COMMAND")).andReturn(null).atLeastOnce();
+
+ Capture<RoleAuthorizationEntity> captureClusterRunCustomCommandEntity = newCapture();
+ roleAuthorizationDAO.create(capture(captureClusterRunCustomCommandEntity));
+ expectLastCall().once();
+
+ Capture<RoleAuthorizationEntity> captureAmbariRunCustomCommandEntity = newCapture();
+ roleAuthorizationDAO.create(capture(captureAmbariRunCustomCommandEntity));
+ expectLastCall().once();
+
+ Injector injector = easyMockSupport.createNiceMock(Injector.class);
+ expect(injector.getInstance(RoleAuthorizationDAO.class)).andReturn(roleAuthorizationDAO).atLeastOnce();
+ expect(injector.getInstance(PermissionDAO.class)).andReturn(permissionDAO).atLeastOnce();
+ expect(injector.getInstance(ResourceTypeDAO.class)).andReturn(resourceTypeDAO).atLeastOnce();
+
+ easyMockSupport.replayAll();
+ new UpgradeCatalog242(injector).createRoleAuthorizations();
+ easyMockSupport.verifyAll();
+
+ RoleAuthorizationEntity ambariRunCustomCommandEntity = captureAmbariRunCustomCommandEntity.getValue();
+ RoleAuthorizationEntity clusterRunCustomCommandEntity = captureClusterRunCustomCommandEntity.getValue();
+
+ Assert.assertEquals("AMBARI.RUN_CUSTOM_COMMAND", ambariRunCustomCommandEntity.getAuthorizationId());
+ Assert.assertEquals("Perform custom administrative actions", ambariRunCustomCommandEntity.getAuthorizationName());
+
+ Assert.assertEquals("CLUSTER.RUN_CUSTOM_COMMAND", clusterRunCustomCommandEntity.getAuthorizationId());
+ Assert.assertEquals("Perform custom cluster-level actions", clusterRunCustomCommandEntity.getAuthorizationName());
+
+ Assert.assertEquals(2, ambariAdministratorAuthorizations.size());
+ Assert.assertTrue(ambariAdministratorAuthorizations.contains(clusterRunCustomCommandEntity));
+ Assert.assertTrue(ambariAdministratorAuthorizations.contains(ambariRunCustomCommandEntity));
+
+ Assert.assertEquals(1, clusterAdministratorAuthorizations.size());
+ Assert.assertTrue(clusterAdministratorAuthorizations.contains(clusterRunCustomCommandEntity));
+ }
+
}
[09/26] ambari git commit: AMBARI-19149. Code cleanup: apply checks
to test sources (Attila Doroszlai via ncole)
Posted by nc...@apache.org.
AMBARI-19149. Code cleanup: apply checks to test sources (Attila Doroszlai via ncole)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4fc52a61
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4fc52a61
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4fc52a61
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 4fc52a61f5515780a85d54051bfbb08ba7e530b1
Parents: 51c4f92
Author: Nate Cole <nc...@hortonworks.com>
Authored: Tue Dec 20 16:02:32 2016 -0500
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Tue Dec 20 16:02:37 2016 -0500
----------------------------------------------------------------------
ambari-project/pom.xml | 3 +-
ambari-server/checkstyle.xml | 2 +-
.../server/upgrade/UpgradeCatalog250.java | 28 +-
.../server/agent/TestHeartbeatHandler.java | 4 +-
.../AmbariCustomCommandExecutionHelperTest.java | 26 +-
.../internal/MemberResourceProviderTest.java | 1 -
.../UpgradeSummaryResourceProviderTest.java | 2 +-
.../logging/LogQueryResponseTest.java | 188 ++++++------
.../LogSearchDataRetrievalServiceTest.java | 8 -
.../logging/LoggingRequestHelperImplTest.java | 284 +++++++------------
.../server/state/ConfigMergeHelperTest.java | 12 +-
.../QuickLinksProfileParserTest.java | 2 +-
.../server/testing/DeadlockedThreadsTest.java | 14 +-
.../server/topology/BlueprintImplTest.java | 1 -
.../ClusterDeployWithStartOnlyTest.java | 1 -
...InstallWithoutStartOnComponentLevelTest.java | 1 -
.../ClusterInstallWithoutStartTest.java | 1 -
.../server/upgrade/UpgradeCatalog210Test.java | 6 +-
.../server/upgrade/UpgradeCatalog221Test.java | 5 +-
.../server/upgrade/UpgradeCatalog250Test.java | 65 ++---
20 files changed, 263 insertions(+), 391 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fc52a61/ambari-project/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-project/pom.xml b/ambari-project/pom.xml
index f3476d7..16ea2af 100644
--- a/ambari-project/pom.xml
+++ b/ambari-project/pom.xml
@@ -31,7 +31,6 @@
<powermock.version>1.6.3</powermock.version>
<jetty.version>8.1.19.v20160209</jetty.version>
<checkstyle.version>6.19</checkstyle.version> <!-- last version that does not require Java 8 -->
- <checkstyle.skip>false</checkstyle.skip>
</properties>
<profiles>
<profile>
@@ -502,8 +501,8 @@
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
<linkXRef>false</linkXRef>
- <skip>${checkstyle.skip}</skip>
</configuration>
<executions>
<execution>
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fc52a61/ambari-server/checkstyle.xml
----------------------------------------------------------------------
diff --git a/ambari-server/checkstyle.xml b/ambari-server/checkstyle.xml
index 0742284..bf7698d 100644
--- a/ambari-server/checkstyle.xml
+++ b/ambari-server/checkstyle.xml
@@ -20,7 +20,7 @@
<module name="AvoidStarImport"/>
<module name="IllegalImport"/>
<module name="ImportOrder">
- <property name="groups" value="java,javax,org,com*"/>
+ <property name="groups" value="java,javax,org,com,*"/>
<property name="ordered" value="true"/>
<property name="separated" value="true"/>
<property name="option" value="top"/> <!-- static imports -->
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fc52a61/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
index 9734212..7a385f3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
@@ -17,8 +17,18 @@
*/
package org.apache.ambari.server.upgrade;
-import com.google.inject.Inject;
-import com.google.inject.Injector;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicLong;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.actionmanager.CommandExecutionType;
@@ -35,18 +45,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.support.JdbcUtils;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicLong;
+import com.google.inject.Inject;
+import com.google.inject.Injector;
/**
* Upgrade catalog for version 2.5.0.
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fc52a61/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
index a7f8a21..e7588c7 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
@@ -973,9 +973,7 @@ public class TestHeartbeatHandler {
ActionQueue aq = new ActionQueue();
ActionManager am = actionManagerTestHelper.getMockActionManager();
- expect(am.getTasks(EasyMock.<List<Long>>anyObject())).andReturn(
- new ArrayList<HostRoleCommand>() {{
- }});
+ expect(am.getTasks(EasyMock.<List<Long>>anyObject())).andReturn(new ArrayList<HostRoleCommand>());
replay(am);
HeartBeatHandler handler = heartbeatTestHelper.getHeartBeatHandler(am, aq);
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fc52a61/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java
index 360509c..246c628 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java
@@ -195,11 +195,7 @@ public class AmbariCustomCommandExecutionHelperTest {
new RequestResourceFilter("GANGLIA", "GANGLIA_MONITOR", Collections.singletonList("c1-c6402"))
),
new RequestOperationLevel(Resource.Type.Service, "c1", "GANGLIA", null, null),
- new HashMap<String, String>() {
- {
- }
- },
- false);
+ new HashMap<String, String>(), false);
EasyMock.replay(hostRoleCommand, actionManager);
@@ -234,10 +230,7 @@ public class AmbariCustomCommandExecutionHelperTest {
new RequestResourceFilter("GANGLIA", "GANGLIA_MONITOR", Collections.singletonList("c1-c6401")),
new RequestResourceFilter("GANGLIA", "GANGLIA_MONITOR", Collections.singletonList("c1-c6402"))),
new RequestOperationLevel(Resource.Type.Service, "c1", "GANGLIA", null, null),
- new HashMap<String, String>() {
- {
- }
- }, false);
+ new HashMap<String, String>(), false);
EasyMock.replay(hostRoleCommand, actionManager);
@@ -274,10 +267,7 @@ public class AmbariCustomCommandExecutionHelperTest {
new RequestResourceFilter("GANGLIA", "GANGLIA_MONITOR", Collections.singletonList("c1-c6401")),
new RequestResourceFilter("GANGLIA", "GANGLIA_MONITOR", Collections.singletonList("c1-c6402"))),
new RequestOperationLevel(Resource.Type.Host, "c1", "GANGLIA", null, null),
- new HashMap<String, String>() {
- {
- }
- }, false);
+ new HashMap<String, String>(), false);
EasyMock.replay(hostRoleCommand, actionManager);
@@ -323,10 +313,7 @@ public class AmbariCustomCommandExecutionHelperTest {
Collections.singletonList("c6402"))),
new RequestOperationLevel(Resource.Type.Service, "c1", "ZOOKEEPER", null, null),
- new HashMap<String, String>() {
- {
- }
- }, false);
+ new HashMap<String, String>(), false);
EasyMock.replay(hostRoleCommand, actionManager);
ambariManagementController.createAction(actionRequest, requestProperties);
@@ -366,10 +353,7 @@ public class AmbariCustomCommandExecutionHelperTest {
Collections.singletonList("c6402"))),
new RequestOperationLevel(Resource.Type.Service, "c1", "ZOOKEEPER", null, null),
- new HashMap<String, String>() {
- {
- }
- }, false);
+ new HashMap<String, String>(), false);
EasyMock.replay(hostRoleCommand, actionManager);
ambariManagementController.createAction(actionRequest, requestProperties);
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fc52a61/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/MemberResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/MemberResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/MemberResourceProviderTest.java
index 438e073..0a50844 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/MemberResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/MemberResourceProviderTest.java
@@ -18,7 +18,6 @@
package org.apache.ambari.server.controller.internal;
-import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.createNiceMock;
import static org.easymock.EasyMock.eq;
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fc52a61/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeSummaryResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeSummaryResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeSummaryResourceProviderTest.java
index baec7df..e398a54 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeSummaryResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeSummaryResourceProviderTest.java
@@ -195,7 +195,7 @@ public class UpgradeSummaryResourceProviderTest {
* @param stageId
*/
@Transactional
- private void createCommands(Cluster cluster, Long upgradeRequestId, Long stageId) {
+ void createCommands(Cluster cluster, Long upgradeRequestId, Long stageId) {
HostEntity h1 = hostDAO.findByName("h1");
ServiceComponentHostEvent event = new ServiceComponentHostOpInProgressEvent("ZOOKEEPER_SERVER", "h1", 1L);
ServiceComponentHostEventWrapper eventWrapper = new ServiceComponentHostEventWrapper(event);
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fc52a61/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LogQueryResponseTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LogQueryResponseTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LogQueryResponseTest.java
index 527306c..0f29400 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LogQueryResponseTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LogQueryResponseTest.java
@@ -127,100 +127,102 @@ public class LogQueryResponseTest {
List<LogLineResult> listOfLineResults =
result.getListOfResults();
- {
- LogLineResult resultOne = listOfLineResults.get(0);
- // verify that all fields in this class are parsed as expected
- assertEquals("Cluster name not parsed properly",
- "clusterone", resultOne.getClusterName());
- assertEquals("Method Name not parsed properly",
- "chooseUnderReplicatedBlocks", resultOne.getLogMethod());
- assertEquals("Log Level not parsed properly",
- "INFO", resultOne.getLogLevel());
- assertEquals("event_count not parsed properly",
- "1", resultOne.getEventCount());
- assertEquals("ip address not parsed properly",
- "192.168.1.1", resultOne.getIpAddress());
- assertEquals("component type not parsed properly",
- "hdfs_namenode", resultOne.getComponentType());
- assertEquals("sequence number not parsed properly",
- "10584", resultOne.getSequenceNumber());
- assertEquals("log file path not parsed properly",
- "/var/log/hadoop/hdfs/hadoop-hdfs-namenode-c6401.ambari.apache.org.log", resultOne.getLogFilePath());
- assertEquals("log src file name not parsed properly",
- "UnderReplicatedBlocks.java", resultOne.getSourceFile());
- assertEquals("log src line number not parsed properly",
- "394", resultOne.getSourceFileLineNumber());
- assertEquals("host name not parsed properly",
- "c6401.ambari.apache.org", resultOne.getHostName());
- assertEquals("log message not parsed properly",
- "chooseUnderReplicatedBlocks selected 2 blocks at priority level 0; Total=2 Reset bookmarks? false", resultOne.getLogMessage());
- assertEquals("logger name not parsed properly",
- "BlockStateChange", resultOne.getLoggerName());
- assertEquals("id not parsed properly",
- "9c5562fb-123f-47c8-aaf5-b5e407326c08", resultOne.getId());
- assertEquals("message MD5 not parsed properly",
- "-3892769501348410581", resultOne.getMessageMD5());
- assertEquals("log time not parsed properly",
- "1458148749036", resultOne.getLogTime());
- assertEquals("event MD5 not parsed properly",
- "1458148749036-2417481968206345035", resultOne.getEventMD5());
- assertEquals("logfile line number not parsed properly",
- "2084", resultOne.getLogFileLineNumber());
- assertEquals("ttl not parsed properly",
- "+7DAYS", resultOne.getTtl());
- assertEquals("expire at not parsed properly",
- "1458753550322", resultOne.getExpirationTime());
- assertEquals("version not parsed properly",
- "1528979784023932928", resultOne.getVersion());
- }
-
- {
- LogLineResult resultTwo = listOfLineResults.get(1);
- // verify second log line record's data is parsed correctly
- assertEquals("Cluster name not parsed properly",
- "clusterone", resultTwo.getClusterName());
- assertEquals("Method Name not parsed properly",
- "putMetrics", resultTwo.getLogMethod());
- assertEquals("Log Level not parsed properly",
- "WARN", resultTwo.getLogLevel());
- assertEquals("event_count not parsed properly",
- "1", resultTwo.getEventCount());
- assertEquals("ip address not parsed properly",
- "192.168.1.1", resultTwo.getIpAddress());
- assertEquals("component type not parsed properly",
- "yarn_resourcemanager", resultTwo.getComponentType());
- assertEquals("sequence number not parsed properly",
- "10583", resultTwo.getSequenceNumber());
- assertEquals("log file path not parsed properly",
- "/var/log/hadoop-yarn/yarn/yarn-yarn-resourcemanager-c6401.ambari.apache.org.log", resultTwo.getLogFilePath());
- assertEquals("log src file name not parsed properly",
- "HadoopTimelineMetricsSink.java", resultTwo.getSourceFile());
- assertEquals("log src line number not parsed properly",
- "262", resultTwo.getSourceFileLineNumber());
- assertEquals("host name not parsed properly",
- "c6401.ambari.apache.org", resultTwo.getHostName());
- assertEquals("log message not parsed properly",
- "Unable to send metrics to collector by address:http://c6401.ambari.apache.org:6188/ws/v1/timeline/metrics", resultTwo.getLogMessage());
- assertEquals("logger name not parsed properly",
- "timeline.HadoopTimelineMetricsSink", resultTwo.getLoggerName());
- assertEquals("id not parsed properly",
- "8361c5a9-5b1c-4f44-bc8f-4c6f07d94228", resultTwo.getId());
- assertEquals("message MD5 not parsed properly",
- "5942185045779825717", resultTwo.getMessageMD5());
- assertEquals("log time not parsed properly",
- "1458148746937", resultTwo.getLogTime());
- assertEquals("event MD5 not parsed properly",
- "14581487469371427138486123628676", resultTwo.getEventMD5());
- assertEquals("logfile line number not parsed properly",
- "549", resultTwo.getLogFileLineNumber());
- assertEquals("ttl not parsed properly",
- "+7DAYS", resultTwo.getTtl());
- assertEquals("expire at not parsed properly",
- "1458753550322", resultTwo.getExpirationTime());
- assertEquals("version not parsed properly",
- "1528979784022884357", resultTwo.getVersion());
- }
+ verifyFirstLine(listOfLineResults);
+ verifySecondLine(listOfLineResults);
+ }
+
+ private static void verifyFirstLine(List<LogLineResult> listOfLineResults) {
+ LogLineResult resultOne = listOfLineResults.get(0);
+ // verify that all fields in this class are parsed as expected
+ assertEquals("Cluster name not parsed properly",
+ "clusterone", resultOne.getClusterName());
+ assertEquals("Method Name not parsed properly",
+ "chooseUnderReplicatedBlocks", resultOne.getLogMethod());
+ assertEquals("Log Level not parsed properly",
+ "INFO", resultOne.getLogLevel());
+ assertEquals("event_count not parsed properly",
+ "1", resultOne.getEventCount());
+ assertEquals("ip address not parsed properly",
+ "192.168.1.1", resultOne.getIpAddress());
+ assertEquals("component type not parsed properly",
+ "hdfs_namenode", resultOne.getComponentType());
+ assertEquals("sequence number not parsed properly",
+ "10584", resultOne.getSequenceNumber());
+ assertEquals("log file path not parsed properly",
+ "/var/log/hadoop/hdfs/hadoop-hdfs-namenode-c6401.ambari.apache.org.log", resultOne.getLogFilePath());
+ assertEquals("log src file name not parsed properly",
+ "UnderReplicatedBlocks.java", resultOne.getSourceFile());
+ assertEquals("log src line number not parsed properly",
+ "394", resultOne.getSourceFileLineNumber());
+ assertEquals("host name not parsed properly",
+ "c6401.ambari.apache.org", resultOne.getHostName());
+ assertEquals("log message not parsed properly",
+ "chooseUnderReplicatedBlocks selected 2 blocks at priority level 0; Total=2 Reset bookmarks? false", resultOne.getLogMessage());
+ assertEquals("logger name not parsed properly",
+ "BlockStateChange", resultOne.getLoggerName());
+ assertEquals("id not parsed properly",
+ "9c5562fb-123f-47c8-aaf5-b5e407326c08", resultOne.getId());
+ assertEquals("message MD5 not parsed properly",
+ "-3892769501348410581", resultOne.getMessageMD5());
+ assertEquals("log time not parsed properly",
+ "1458148749036", resultOne.getLogTime());
+ assertEquals("event MD5 not parsed properly",
+ "1458148749036-2417481968206345035", resultOne.getEventMD5());
+ assertEquals("logfile line number not parsed properly",
+ "2084", resultOne.getLogFileLineNumber());
+ assertEquals("ttl not parsed properly",
+ "+7DAYS", resultOne.getTtl());
+ assertEquals("expire at not parsed properly",
+ "1458753550322", resultOne.getExpirationTime());
+ assertEquals("version not parsed properly",
+ "1528979784023932928", resultOne.getVersion());
+ }
+ private static void verifySecondLine(List<LogLineResult> listOfLineResults) {
+ LogLineResult resultTwo = listOfLineResults.get(1);
+ // verify second log line record's data is parsed correctly
+ assertEquals("Cluster name not parsed properly",
+ "clusterone", resultTwo.getClusterName());
+ assertEquals("Method Name not parsed properly",
+ "putMetrics", resultTwo.getLogMethod());
+ assertEquals("Log Level not parsed properly",
+ "WARN", resultTwo.getLogLevel());
+ assertEquals("event_count not parsed properly",
+ "1", resultTwo.getEventCount());
+ assertEquals("ip address not parsed properly",
+ "192.168.1.1", resultTwo.getIpAddress());
+ assertEquals("component type not parsed properly",
+ "yarn_resourcemanager", resultTwo.getComponentType());
+ assertEquals("sequence number not parsed properly",
+ "10583", resultTwo.getSequenceNumber());
+ assertEquals("log file path not parsed properly",
+ "/var/log/hadoop-yarn/yarn/yarn-yarn-resourcemanager-c6401.ambari.apache.org.log", resultTwo.getLogFilePath());
+ assertEquals("log src file name not parsed properly",
+ "HadoopTimelineMetricsSink.java", resultTwo.getSourceFile());
+ assertEquals("log src line number not parsed properly",
+ "262", resultTwo.getSourceFileLineNumber());
+ assertEquals("host name not parsed properly",
+ "c6401.ambari.apache.org", resultTwo.getHostName());
+ assertEquals("log message not parsed properly",
+ "Unable to send metrics to collector by address:http://c6401.ambari.apache.org:6188/ws/v1/timeline/metrics", resultTwo.getLogMessage());
+ assertEquals("logger name not parsed properly",
+ "timeline.HadoopTimelineMetricsSink", resultTwo.getLoggerName());
+ assertEquals("id not parsed properly",
+ "8361c5a9-5b1c-4f44-bc8f-4c6f07d94228", resultTwo.getId());
+ assertEquals("message MD5 not parsed properly",
+ "5942185045779825717", resultTwo.getMessageMD5());
+ assertEquals("log time not parsed properly",
+ "1458148746937", resultTwo.getLogTime());
+ assertEquals("event MD5 not parsed properly",
+ "14581487469371427138486123628676", resultTwo.getEventMD5());
+ assertEquals("logfile line number not parsed properly",
+ "549", resultTwo.getLogFileLineNumber());
+ assertEquals("ttl not parsed properly",
+ "+7DAYS", resultTwo.getTtl());
+ assertEquals("expire at not parsed properly",
+ "1458753550322", resultTwo.getExpirationTime());
+ assertEquals("version not parsed properly",
+ "1528979784022884357", resultTwo.getVersion());
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fc52a61/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LogSearchDataRetrievalServiceTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LogSearchDataRetrievalServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LogSearchDataRetrievalServiceTest.java
index 1b365e5..033d698 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LogSearchDataRetrievalServiceTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LogSearchDataRetrievalServiceTest.java
@@ -36,14 +36,6 @@ import org.junit.Test;
import com.google.common.cache.Cache;
import com.google.inject.Injector;
-
-
-import org.apache.ambari.server.controller.AmbariManagementController;
-import org.easymock.EasyMockSupport;
-import org.junit.Test;
-
-import com.google.common.cache.Cache;
-
/**
* This test verifies the basic behavior of the
* LogSearchDataRetrievalServiceTest, and should
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fc52a61/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImplTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImplTest.java
index cb65780..11e56e2 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImplTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImplTest.java
@@ -208,99 +208,8 @@ public class LoggingRequestHelperImplTest {
List<LogLineResult> listOfLineResults =
result.getListOfResults();
- {
- LogLineResult resultOne = listOfLineResults.get(0);
- // verify that all fields in this class are parsed as expected
- assertEquals("Cluster name not parsed properly",
- "clusterone", resultOne.getClusterName());
- assertEquals("Method Name not parsed properly",
- "chooseUnderReplicatedBlocks", resultOne.getLogMethod());
- assertEquals("Log Level not parsed properly",
- "INFO", resultOne.getLogLevel());
- assertEquals("event_count not parsed properly",
- "1", resultOne.getEventCount());
- assertEquals("ip address not parsed properly",
- "192.168.1.1", resultOne.getIpAddress());
- assertEquals("component type not parsed properly",
- "hdfs_namenode", resultOne.getComponentType());
- assertEquals("sequence number not parsed properly",
- "10584", resultOne.getSequenceNumber());
- assertEquals("log file path not parsed properly",
- "/var/log/hadoop/hdfs/hadoop-hdfs-namenode-c6401.ambari.apache.org.log", resultOne.getLogFilePath());
- assertEquals("log src file name not parsed properly",
- "UnderReplicatedBlocks.java", resultOne.getSourceFile());
- assertEquals("log src line number not parsed properly",
- "394", resultOne.getSourceFileLineNumber());
- assertEquals("host name not parsed properly",
- "c6401.ambari.apache.org", resultOne.getHostName());
- assertEquals("log message not parsed properly",
- "chooseUnderReplicatedBlocks selected 2 blocks at priority level 0; Total=2 Reset bookmarks? false", resultOne.getLogMessage());
- assertEquals("logger name not parsed properly",
- "BlockStateChange", resultOne.getLoggerName());
- assertEquals("id not parsed properly",
- "9c5562fb-123f-47c8-aaf5-b5e407326c08", resultOne.getId());
- assertEquals("message MD5 not parsed properly",
- "-3892769501348410581", resultOne.getMessageMD5());
- assertEquals("log time not parsed properly",
- "1458148749036", resultOne.getLogTime());
- assertEquals("event MD5 not parsed properly",
- "1458148749036-2417481968206345035", resultOne.getEventMD5());
- assertEquals("logfile line number not parsed properly",
- "2084", resultOne.getLogFileLineNumber());
- assertEquals("ttl not parsed properly",
- "+7DAYS", resultOne.getTtl());
- assertEquals("expire at not parsed properly",
- "1458753550322", resultOne.getExpirationTime());
- assertEquals("version not parsed properly",
- "1528979784023932928", resultOne.getVersion());
- }
-
- {
- LogLineResult resultTwo = listOfLineResults.get(1);
- // verify second log line record's data is parsed correctly
- assertEquals("Cluster name not parsed properly",
- "clusterone", resultTwo.getClusterName());
- assertEquals("Method Name not parsed properly",
- "putMetrics", resultTwo.getLogMethod());
- assertEquals("Log Level not parsed properly",
- "WARN", resultTwo.getLogLevel());
- assertEquals("event_count not parsed properly",
- "1", resultTwo.getEventCount());
- assertEquals("ip address not parsed properly",
- "192.168.1.1", resultTwo.getIpAddress());
- assertEquals("component type not parsed properly",
- "yarn_resourcemanager", resultTwo.getComponentType());
- assertEquals("sequence number not parsed properly",
- "10583", resultTwo.getSequenceNumber());
- assertEquals("log file path not parsed properly",
- "/var/log/hadoop-yarn/yarn/yarn-yarn-resourcemanager-c6401.ambari.apache.org.log", resultTwo.getLogFilePath());
- assertEquals("log src file name not parsed properly",
- "HadoopTimelineMetricsSink.java", resultTwo.getSourceFile());
- assertEquals("log src line number not parsed properly",
- "262", resultTwo.getSourceFileLineNumber());
- assertEquals("host name not parsed properly",
- "c6401.ambari.apache.org", resultTwo.getHostName());
- assertEquals("log message not parsed properly",
- "Unable to send metrics to collector by address:http://c6401.ambari.apache.org:6188/ws/v1/timeline/metrics", resultTwo.getLogMessage());
- assertEquals("logger name not parsed properly",
- "timeline.HadoopTimelineMetricsSink", resultTwo.getLoggerName());
- assertEquals("id not parsed properly",
- "8361c5a9-5b1c-4f44-bc8f-4c6f07d94228", resultTwo.getId());
- assertEquals("message MD5 not parsed properly",
- "5942185045779825717", resultTwo.getMessageMD5());
- assertEquals("log time not parsed properly",
- "1458148746937", resultTwo.getLogTime());
- assertEquals("event MD5 not parsed properly",
- "14581487469371427138486123628676", resultTwo.getEventMD5());
- assertEquals("logfile line number not parsed properly",
- "549", resultTwo.getLogFileLineNumber());
- assertEquals("ttl not parsed properly",
- "+7DAYS", resultTwo.getTtl());
- assertEquals("expire at not parsed properly",
- "1458753550322", resultTwo.getExpirationTime());
- assertEquals("version not parsed properly",
- "1528979784022884357", resultTwo.getVersion());
- }
+ verifyFirstLine(listOfLineResults);
+ verifySecondLine(listOfLineResults);
mockSupport.verifyAll();
}
@@ -647,103 +556,106 @@ public class LoggingRequestHelperImplTest {
List<LogLineResult> listOfLineResults =
result.getListOfResults();
- {
- LogLineResult resultOne = listOfLineResults.get(0);
- // verify that all fields in this class are parsed as expected
- assertEquals("Cluster name not parsed properly",
- "clusterone", resultOne.getClusterName());
- assertEquals("Method Name not parsed properly",
- "chooseUnderReplicatedBlocks", resultOne.getLogMethod());
- assertEquals("Log Level not parsed properly",
- "INFO", resultOne.getLogLevel());
- assertEquals("event_count not parsed properly",
- "1", resultOne.getEventCount());
- assertEquals("ip address not parsed properly",
- "192.168.1.1", resultOne.getIpAddress());
- assertEquals("component type not parsed properly",
- "hdfs_namenode", resultOne.getComponentType());
- assertEquals("sequence number not parsed properly",
- "10584", resultOne.getSequenceNumber());
- assertEquals("log file path not parsed properly",
- "/var/log/hadoop/hdfs/hadoop-hdfs-namenode-c6401.ambari.apache.org.log", resultOne.getLogFilePath());
- assertEquals("log src file name not parsed properly",
- "UnderReplicatedBlocks.java", resultOne.getSourceFile());
- assertEquals("log src line number not parsed properly",
- "394", resultOne.getSourceFileLineNumber());
- assertEquals("host name not parsed properly",
- "c6401.ambari.apache.org", resultOne.getHostName());
- assertEquals("log message not parsed properly",
- "chooseUnderReplicatedBlocks selected 2 blocks at priority level 0; Total=2 Reset bookmarks? false", resultOne.getLogMessage());
- assertEquals("logger name not parsed properly",
- "BlockStateChange", resultOne.getLoggerName());
- assertEquals("id not parsed properly",
- "9c5562fb-123f-47c8-aaf5-b5e407326c08", resultOne.getId());
- assertEquals("message MD5 not parsed properly",
- "-3892769501348410581", resultOne.getMessageMD5());
- assertEquals("log time not parsed properly",
- "1458148749036", resultOne.getLogTime());
- assertEquals("event MD5 not parsed properly",
- "1458148749036-2417481968206345035", resultOne.getEventMD5());
- assertEquals("logfile line number not parsed properly",
- "2084", resultOne.getLogFileLineNumber());
- assertEquals("ttl not parsed properly",
- "+7DAYS", resultOne.getTtl());
- assertEquals("expire at not parsed properly",
- "1458753550322", resultOne.getExpirationTime());
- assertEquals("version not parsed properly",
- "1528979784023932928", resultOne.getVersion());
- }
-
- {
- LogLineResult resultTwo = listOfLineResults.get(1);
- // verify second log line record's data is parsed correctly
- assertEquals("Cluster name not parsed properly",
- "clusterone", resultTwo.getClusterName());
- assertEquals("Method Name not parsed properly",
- "putMetrics", resultTwo.getLogMethod());
- assertEquals("Log Level not parsed properly",
- "WARN", resultTwo.getLogLevel());
- assertEquals("event_count not parsed properly",
- "1", resultTwo.getEventCount());
- assertEquals("ip address not parsed properly",
- "192.168.1.1", resultTwo.getIpAddress());
- assertEquals("component type not parsed properly",
- "yarn_resourcemanager", resultTwo.getComponentType());
- assertEquals("sequence number not parsed properly",
- "10583", resultTwo.getSequenceNumber());
- assertEquals("log file path not parsed properly",
- "/var/log/hadoop-yarn/yarn/yarn-yarn-resourcemanager-c6401.ambari.apache.org.log", resultTwo.getLogFilePath());
- assertEquals("log src file name not parsed properly",
- "HadoopTimelineMetricsSink.java", resultTwo.getSourceFile());
- assertEquals("log src line number not parsed properly",
- "262", resultTwo.getSourceFileLineNumber());
- assertEquals("host name not parsed properly",
- "c6401.ambari.apache.org", resultTwo.getHostName());
- assertEquals("log message not parsed properly",
- "Unable to send metrics to collector by address:http://c6401.ambari.apache.org:6188/ws/v1/timeline/metrics", resultTwo.getLogMessage());
- assertEquals("logger name not parsed properly",
- "timeline.HadoopTimelineMetricsSink", resultTwo.getLoggerName());
- assertEquals("id not parsed properly",
- "8361c5a9-5b1c-4f44-bc8f-4c6f07d94228", resultTwo.getId());
- assertEquals("message MD5 not parsed properly",
- "5942185045779825717", resultTwo.getMessageMD5());
- assertEquals("log time not parsed properly",
- "1458148746937", resultTwo.getLogTime());
- assertEquals("event MD5 not parsed properly",
- "14581487469371427138486123628676", resultTwo.getEventMD5());
- assertEquals("logfile line number not parsed properly",
- "549", resultTwo.getLogFileLineNumber());
- assertEquals("ttl not parsed properly",
- "+7DAYS", resultTwo.getTtl());
- assertEquals("expire at not parsed properly",
- "1458753550322", resultTwo.getExpirationTime());
- assertEquals("version not parsed properly",
- "1528979784022884357", resultTwo.getVersion());
- }
+ verifyFirstLine(listOfLineResults);
+ verifySecondLine(listOfLineResults);
mockSupport.verifyAll();
}
+ private static void verifyFirstLine(List<LogLineResult> listOfLineResults) {
+ LogLineResult resultOne = listOfLineResults.get(0);
+ // verify that all fields in this class are parsed as expected
+ assertEquals("Cluster name not parsed properly",
+ "clusterone", resultOne.getClusterName());
+ assertEquals("Method Name not parsed properly",
+ "chooseUnderReplicatedBlocks", resultOne.getLogMethod());
+ assertEquals("Log Level not parsed properly",
+ "INFO", resultOne.getLogLevel());
+ assertEquals("event_count not parsed properly",
+ "1", resultOne.getEventCount());
+ assertEquals("ip address not parsed properly",
+ "192.168.1.1", resultOne.getIpAddress());
+ assertEquals("component type not parsed properly",
+ "hdfs_namenode", resultOne.getComponentType());
+ assertEquals("sequence number not parsed properly",
+ "10584", resultOne.getSequenceNumber());
+ assertEquals("log file path not parsed properly",
+ "/var/log/hadoop/hdfs/hadoop-hdfs-namenode-c6401.ambari.apache.org.log", resultOne.getLogFilePath());
+ assertEquals("log src file name not parsed properly",
+ "UnderReplicatedBlocks.java", resultOne.getSourceFile());
+ assertEquals("log src line number not parsed properly",
+ "394", resultOne.getSourceFileLineNumber());
+ assertEquals("host name not parsed properly",
+ "c6401.ambari.apache.org", resultOne.getHostName());
+ assertEquals("log message not parsed properly",
+ "chooseUnderReplicatedBlocks selected 2 blocks at priority level 0; Total=2 Reset bookmarks? false", resultOne.getLogMessage());
+ assertEquals("logger name not parsed properly",
+ "BlockStateChange", resultOne.getLoggerName());
+ assertEquals("id not parsed properly",
+ "9c5562fb-123f-47c8-aaf5-b5e407326c08", resultOne.getId());
+ assertEquals("message MD5 not parsed properly",
+ "-3892769501348410581", resultOne.getMessageMD5());
+ assertEquals("log time not parsed properly",
+ "1458148749036", resultOne.getLogTime());
+ assertEquals("event MD5 not parsed properly",
+ "1458148749036-2417481968206345035", resultOne.getEventMD5());
+ assertEquals("logfile line number not parsed properly",
+ "2084", resultOne.getLogFileLineNumber());
+ assertEquals("ttl not parsed properly",
+ "+7DAYS", resultOne.getTtl());
+ assertEquals("expire at not parsed properly",
+ "1458753550322", resultOne.getExpirationTime());
+ assertEquals("version not parsed properly",
+ "1528979784023932928", resultOne.getVersion());
+ }
+
+ private static void verifySecondLine(List<LogLineResult> listOfLineResults) {
+ LogLineResult resultTwo = listOfLineResults.get(1);
+ // verify second log line record's data is parsed correctly
+ assertEquals("Cluster name not parsed properly",
+ "clusterone", resultTwo.getClusterName());
+ assertEquals("Method Name not parsed properly",
+ "putMetrics", resultTwo.getLogMethod());
+ assertEquals("Log Level not parsed properly",
+ "WARN", resultTwo.getLogLevel());
+ assertEquals("event_count not parsed properly",
+ "1", resultTwo.getEventCount());
+ assertEquals("ip address not parsed properly",
+ "192.168.1.1", resultTwo.getIpAddress());
+ assertEquals("component type not parsed properly",
+ "yarn_resourcemanager", resultTwo.getComponentType());
+ assertEquals("sequence number not parsed properly",
+ "10583", resultTwo.getSequenceNumber());
+ assertEquals("log file path not parsed properly",
+ "/var/log/hadoop-yarn/yarn/yarn-yarn-resourcemanager-c6401.ambari.apache.org.log", resultTwo.getLogFilePath());
+ assertEquals("log src file name not parsed properly",
+ "HadoopTimelineMetricsSink.java", resultTwo.getSourceFile());
+ assertEquals("log src line number not parsed properly",
+ "262", resultTwo.getSourceFileLineNumber());
+ assertEquals("host name not parsed properly",
+ "c6401.ambari.apache.org", resultTwo.getHostName());
+ assertEquals("log message not parsed properly",
+ "Unable to send metrics to collector by address:http://c6401.ambari.apache.org:6188/ws/v1/timeline/metrics", resultTwo.getLogMessage());
+ assertEquals("logger name not parsed properly",
+ "timeline.HadoopTimelineMetricsSink", resultTwo.getLoggerName());
+ assertEquals("id not parsed properly",
+ "8361c5a9-5b1c-4f44-bc8f-4c6f07d94228", resultTwo.getId());
+ assertEquals("message MD5 not parsed properly",
+ "5942185045779825717", resultTwo.getMessageMD5());
+ assertEquals("log time not parsed properly",
+ "1458148746937", resultTwo.getLogTime());
+ assertEquals("event MD5 not parsed properly",
+ "14581487469371427138486123628676", resultTwo.getEventMD5());
+ assertEquals("logfile line number not parsed properly",
+ "549", resultTwo.getLogFileLineNumber());
+ assertEquals("ttl not parsed properly",
+ "+7DAYS", resultTwo.getTtl());
+ assertEquals("expire at not parsed properly",
+ "1458753550322", resultTwo.getExpirationTime());
+ assertEquals("version not parsed properly",
+ "1528979784022884357", resultTwo.getVersion());
+ }
+
@Test
public void testCreateLogFileTailURI() throws Exception {
LoggingCookieStore.INSTANCE.getCookiesMap().clear();
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fc52a61/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigMergeHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigMergeHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigMergeHelperTest.java
index 84f81e6..112d3c5 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigMergeHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigMergeHelperTest.java
@@ -134,25 +134,19 @@ public class ConfigMergeHelperTest {
newStackId.getStackVersion())).andReturn(newStackProperties);
// desired config of hdfs-env.xml
- Map<String, String> desiredHdfsEnvProperties = new HashMap<String, String>() {{
-
- }};
+ Map<String, String> desiredHdfsEnvProperties = new HashMap<>();
expect(clusterMock.getDesiredConfigByType("hdfs-env.xml")).andReturn(
createConfigMock(desiredHdfsEnvProperties)
);
// desired config of zk-env.xml
- Map<String, String> desiredZkEnvProperties = new HashMap<String, String>() {{
-
- }};
+ Map<String, String> desiredZkEnvProperties = new HashMap<>();
expect(clusterMock.getDesiredConfigByType("hdfs-env.xml")).andReturn(
createConfigMock(desiredZkEnvProperties)
);
// desired config of hadoop-env.xml
- Map<String, String> desiredHadoopEnvProperties = new HashMap<String, String>() {{
-
- }};
+ Map<String, String> desiredHadoopEnvProperties = new HashMap<>();
expect(clusterMock.getDesiredConfigByType("hadoop-env.xml")).andReturn(
createConfigMock(desiredHadoopEnvProperties)
);
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fc52a61/ambari-server/src/test/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileParserTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileParserTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileParserTest.java
index 0644027..5f93475 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileParserTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileParserTest.java
@@ -20,10 +20,10 @@ package org.apache.ambari.server.state.quicklinksprofile;
import static org.junit.Assert.assertEquals;
-import com.google.common.io.Resources;
import org.codehaus.jackson.JsonParseException;
import org.junit.Test;
+import com.google.common.io.Resources;
public class QuickLinksProfileParserTest {
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fc52a61/ambari-server/src/test/java/org/apache/ambari/server/testing/DeadlockedThreadsTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/testing/DeadlockedThreadsTest.java b/ambari-server/src/test/java/org/apache/ambari/server/testing/DeadlockedThreadsTest.java
index 0e99db5..922b334 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/testing/DeadlockedThreadsTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/testing/DeadlockedThreadsTest.java
@@ -172,16 +172,16 @@ public class DeadlockedThreadsTest {
}
}
private void f() {
- w.lock(); {
- g();
- } w.unlock();
+ w.lock();
+ g();
+ w.unlock();
}
private void g() {
- r.lock(); {
- // do some work...
- for (int i = 0; i < 1000 * 1000; i++) ;
- } r.unlock();
+ r.lock();
+ // do some work...
+ for (int i = 0; i < 1000 * 1000; i++) ;
+ r.unlock();
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fc52a61/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintImplTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintImplTest.java
index 1ffd8f7..8107d09 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintImplTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintImplTest.java
@@ -37,7 +37,6 @@ import java.util.Set;
import org.apache.ambari.server.controller.internal.Stack;
import org.apache.ambari.server.orm.entities.BlueprintEntity;
import org.apache.ambari.server.state.SecurityType;
-import org.easymock.EasyMock;
import org.junit.Before;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fc52a61/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterDeployWithStartOnlyTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterDeployWithStartOnlyTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterDeployWithStartOnlyTest.java
index c205e57..748b4e9 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterDeployWithStartOnlyTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterDeployWithStartOnlyTest.java
@@ -67,7 +67,6 @@ import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.ComponentInfo;
import org.apache.ambari.server.state.SecurityType;
import org.easymock.Capture;
-import org.easymock.EasyMock;
import org.easymock.EasyMockRule;
import org.easymock.EasyMockSupport;
import org.easymock.Mock;
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fc52a61/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartOnComponentLevelTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartOnComponentLevelTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartOnComponentLevelTest.java
index b276ecf..a1f3d25 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartOnComponentLevelTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartOnComponentLevelTest.java
@@ -68,7 +68,6 @@ import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.ComponentInfo;
import org.apache.ambari.server.state.SecurityType;
import org.easymock.Capture;
-import org.easymock.EasyMock;
import org.easymock.EasyMockRule;
import org.easymock.EasyMockSupport;
import org.easymock.Mock;
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fc52a61/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java
index 58862f1..33f318a 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java
@@ -68,7 +68,6 @@ import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.ComponentInfo;
import org.apache.ambari.server.state.SecurityType;
import org.easymock.Capture;
-import org.easymock.EasyMock;
import org.easymock.EasyMockRule;
import org.easymock.EasyMockSupport;
import org.easymock.Mock;
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fc52a61/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java
index 36f66c6..7106021 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java
@@ -480,8 +480,7 @@ public class UpgradeCatalog210Test {
final Map<String, String> propertiesExpectedHiveSite = new HashMap<String, String>() {{
put("hive.server2.authentication", "kerberos");
}};
- final Map<String, String> propertiesExpectedHiveServerSite = new HashMap<String, String>() {{
- }};
+ final Map<String, String> propertiesExpectedHiveServerSite = new HashMap<>();
final Map<String, Service> servicesExpected = new HashMap<String, Service>(){{
put("KERBEROS", null);
}};
@@ -555,8 +554,7 @@ public class UpgradeCatalog210Test {
final Map<String, String> propertiesExpectedHiveEnv = new HashMap<String, String>() {{
put("hive_security_authorization", "none");
}};
- final Map<String, String> propertiesExpectedHiveSite = new HashMap<String, String>() {{
- }};
+ final Map<String, String> propertiesExpectedHiveSite = new HashMap<>();
final Map<String, String> propertiesExpectedPluginProperies = new HashMap<String, String>() {{
put("ranger-hive-plugin-enabled", "yes");
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fc52a61/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java
index 27b1174..55ae3ff 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java
@@ -478,10 +478,7 @@ public class UpgradeCatalog221Test {
}
};
- Map<String, String> newPropertiesAmsHbaseSecuritySite = new HashMap<String, String>() {
- {
- }
- };
+ Map<String, String> newPropertiesAmsHbaseSecuritySite = new HashMap<>();
EasyMockSupport easyMockSupport = new EasyMockSupport();
Clusters clusters = easyMockSupport.createNiceMock(Clusters.class);
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fc52a61/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
index 24b4570..8568a19 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
@@ -18,14 +18,31 @@
package org.apache.ambari.server.upgrade;
-import com.google.common.collect.Maps;
-import com.google.gson.Gson;
-import com.google.inject.Binder;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import com.google.inject.Module;
-import com.google.inject.Provider;
-import junit.framework.Assert;
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.anyString;
+import static org.easymock.EasyMock.capture;
+import static org.easymock.EasyMock.createMockBuilder;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.newCapture;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.reset;
+import static org.easymock.EasyMock.verify;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Method;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.actionmanager.ActionManager;
@@ -53,34 +70,18 @@ import org.easymock.EasyMockSupport;
import org.easymock.Mock;
import org.easymock.MockType;
import org.junit.After;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import javax.persistence.EntityManager;
-import java.lang.reflect.Method;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.easymock.EasyMock.anyObject;
-import static org.easymock.EasyMock.anyString;
-import static org.easymock.EasyMock.capture;
-import static org.easymock.EasyMock.createMockBuilder;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.newCapture;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.reset;
-import static org.easymock.EasyMock.verify;
-import static org.junit.Assert.assertTrue;
+import com.google.common.collect.Maps;
+import com.google.gson.Gson;
+import com.google.inject.Binder;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Module;
+import com.google.inject.Provider;
/**
* {@link UpgradeCatalog250} unit tests.
[15/26] ambari git commit: AMBARI-19235. 'Cluster User' role issue
after Ambari 2.4.2.0 upgrade (echekanskiy via dlysnichenko)
Posted by nc...@apache.org.
AMBARI-19235. 'Cluster User' role issue after Ambari 2.4.2.0 upgrade (echekanskiy via dlysnichenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c08df0ef
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c08df0ef
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c08df0ef
Branch: refs/heads/branch-dev-patch-upgrade
Commit: c08df0ef4aa67acba21c057e0b0ffd4cb6f0fde7
Parents: 7990368
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Wed Dec 21 17:48:39 2016 +0200
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Wed Dec 21 17:49:40 2016 +0200
----------------------------------------------------------------------
.../AmbariLdapAuthoritiesPopulator.java | 21 ++-----
...ariAuthorizationProviderDisableUserTest.java | 2 +-
.../TestAmbariLdapAuthoritiesPopulator.java | 63 ++------------------
3 files changed, 12 insertions(+), 74 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/c08df0ef/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthoritiesPopulator.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthoritiesPopulator.java b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthoritiesPopulator.java
index b3be046..92037fc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthoritiesPopulator.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthoritiesPopulator.java
@@ -19,14 +19,10 @@ package org.apache.ambari.server.security.authorization;
import java.util.Collection;
import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
import org.apache.ambari.server.orm.dao.MemberDAO;
import org.apache.ambari.server.orm.dao.PrivilegeDAO;
import org.apache.ambari.server.orm.dao.UserDAO;
-import org.apache.ambari.server.orm.entities.MemberEntity;
-import org.apache.ambari.server.orm.entities.PrincipalEntity;
import org.apache.ambari.server.orm.entities.PrivilegeEntity;
import org.apache.ambari.server.orm.entities.UserEntity;
import org.slf4j.Logger;
@@ -47,14 +43,17 @@ public class AmbariLdapAuthoritiesPopulator implements LdapAuthoritiesPopulator
UserDAO userDAO;
MemberDAO memberDAO;
PrivilegeDAO privilegeDAO;
+ Users users;
@Inject
public AmbariLdapAuthoritiesPopulator(AuthorizationHelper authorizationHelper,
- UserDAO userDAO, MemberDAO memberDAO, PrivilegeDAO privilegeDAO) {
+ UserDAO userDAO, MemberDAO memberDAO, PrivilegeDAO privilegeDAO,
+ Users users) {
this.authorizationHelper = authorizationHelper;
this.userDAO = userDAO;
this.memberDAO = memberDAO;
this.privilegeDAO = privilegeDAO;
+ this.users = users;
}
@Override
@@ -74,18 +73,8 @@ public class AmbariLdapAuthoritiesPopulator implements LdapAuthoritiesPopulator
if(!user.getActive()){
throw new InvalidUsernamePasswordCombinationException();
}
- // get all of the privileges for the user
- List<PrincipalEntity> principalEntities = new LinkedList<PrincipalEntity>();
- principalEntities.add(user.getPrincipal());
-
- List<MemberEntity> memberEntities = memberDAO.findAllMembersByUser(user);
-
- for (MemberEntity memberEntity : memberEntities) {
- principalEntities.add(memberEntity.getGroup().getPrincipal());
- }
-
- List<PrivilegeEntity> privilegeEntities = privilegeDAO.findAllByPrincipal(principalEntities);
+ Collection<PrivilegeEntity> privilegeEntities = users.getUserPrivileges(user);
return authorizationHelper.convertPrivilegesToAuthorities(privilegeEntities);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c08df0ef/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariAuthorizationProviderDisableUserTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariAuthorizationProviderDisableUserTest.java b/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariAuthorizationProviderDisableUserTest.java
index 90d4be0..6b98a5b 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariAuthorizationProviderDisableUserTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariAuthorizationProviderDisableUserTest.java
@@ -58,7 +58,7 @@ public class AmbariAuthorizationProviderDisableUserTest {
alup = new AmbariLocalUserProvider(userDAO, users, encoder);
- ldapPopulator = new AmbariLdapAuthoritiesPopulator(authorizationHelper, userDAO, memberDao, privilegeDao);
+ ldapPopulator = new AmbariLdapAuthoritiesPopulator(authorizationHelper, userDAO, memberDao, privilegeDao, users);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c08df0ef/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/TestAmbariLdapAuthoritiesPopulator.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/TestAmbariLdapAuthoritiesPopulator.java b/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/TestAmbariLdapAuthoritiesPopulator.java
index 5715906..cf6cd32 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/TestAmbariLdapAuthoritiesPopulator.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/TestAmbariLdapAuthoritiesPopulator.java
@@ -20,18 +20,12 @@ package org.apache.ambari.server.security.authorization;
import static org.easymock.EasyMock.expect;
import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
import org.apache.ambari.server.orm.dao.MemberDAO;
import org.apache.ambari.server.orm.dao.PrivilegeDAO;
import org.apache.ambari.server.orm.dao.UserDAO;
-import org.apache.ambari.server.orm.entities.GroupEntity;
-import org.apache.ambari.server.orm.entities.MemberEntity;
-import org.apache.ambari.server.orm.entities.PrincipalEntity;
import org.apache.ambari.server.orm.entities.PrivilegeEntity;
import org.apache.ambari.server.orm.entities.UserEntity;
-import org.easymock.EasyMock;
import org.easymock.EasyMockSupport;
import org.junit.Before;
import org.junit.Test;
@@ -47,14 +41,11 @@ public class TestAmbariLdapAuthoritiesPopulator extends EasyMockSupport {
AuthorizationHelper helper = new AuthorizationHelper();
UserDAO userDAO = createMock(UserDAO.class);
+ Users users = createMock(Users.class);
MemberDAO memberDAO = createMock(MemberDAO.class);
PrivilegeDAO privilegeDAO = createMock(PrivilegeDAO.class);
DirContextOperations userData = createMock(DirContextOperations.class);
UserEntity userEntity = createMock(UserEntity.class);
- PrincipalEntity principalEntity = createMock(PrincipalEntity.class);
- PrincipalEntity groupPrincipalEntity = createMock(PrincipalEntity.class);
- MemberEntity memberEntity = createMock(MemberEntity.class);
- GroupEntity groupEntity = createMock(GroupEntity.class);
PrivilegeEntity privilegeEntity = createMock(PrivilegeEntity.class);
@Before
@@ -64,21 +55,14 @@ public class TestAmbariLdapAuthoritiesPopulator extends EasyMockSupport {
}
@Test
- public void testGetGrantedAuthorities_mappingDisabled() throws Exception {
+ public void testGetGrantedAuthorities() throws Exception {
String username = "user";
AmbariLdapAuthoritiesPopulator populator = createMockBuilder(AmbariLdapAuthoritiesPopulator.class)
- .withConstructor(helper, userDAO, memberDAO, privilegeDAO).createMock();
+ .withConstructor(helper, userDAO, memberDAO, privilegeDAO, users).createMock();
- expect(userEntity.getPrincipal()).andReturn(principalEntity);
expect(userEntity.getActive()).andReturn(true);
- expect(memberDAO.findAllMembersByUser(userEntity)).andReturn(Collections.singletonList(memberEntity));
- expect(memberEntity.getGroup()).andReturn(groupEntity);
- expect(groupEntity.getPrincipal()).andReturn(groupPrincipalEntity);
- List<PrincipalEntity> principalEntityList = new LinkedList<PrincipalEntity>();
- principalEntityList.add(principalEntity);
- principalEntityList.add(groupPrincipalEntity);
- expect(privilegeDAO.findAllByPrincipal(principalEntityList)).andReturn(Collections.singletonList(privilegeEntity));
+ expect(users.getUserPrivileges(userEntity)).andReturn(Collections.singletonList(privilegeEntity));
expect(userDAO.findLdapUserByName(username)).andReturn(userEntity);
replayAll();
@@ -90,34 +74,6 @@ public class TestAmbariLdapAuthoritiesPopulator extends EasyMockSupport {
}
@Test
- public void testGetGrantedAuthorities_mappingEnabled() throws Exception {
-
- AmbariLdapAuthoritiesPopulator populator = createMockBuilder(AmbariLdapAuthoritiesPopulator.class)
- .withConstructor(helper, userDAO, memberDAO, privilegeDAO).createMock();
-
- expect(userEntity.getPrincipal()).andReturn(principalEntity).anyTimes();
- expect(userEntity.getActive()).andReturn(true);
- expect(memberDAO.findAllMembersByUser(userEntity)).andReturn(Collections.singletonList(memberEntity)).anyTimes();
- expect(memberEntity.getGroup()).andReturn(groupEntity).anyTimes();
- expect(groupEntity.getPrincipal()).andReturn(groupPrincipalEntity).anyTimes();
- List<PrincipalEntity> principalEntityList = new LinkedList<PrincipalEntity>();
- principalEntityList.add(principalEntity);
- principalEntityList.add(groupPrincipalEntity);
- expect(privilegeDAO.findAllByPrincipal(principalEntityList)).andReturn(Collections.singletonList(privilegeEntity)).anyTimes();
-
- expect(userDAO.findLdapUserByName(EasyMock.<String> anyObject())).andReturn(null).andReturn(userEntity).once();
-
- replayAll();
-
- //test with admin user
- populator.getGrantedAuthorities(userData, "admin");
- //test with non-admin
- populator.getGrantedAuthorities(userData, "user");
-
- verifyAll();
- }
-
- @Test
public void testGetGrantedAuthoritiesWithLoginAlias() throws Exception {
// Given
String loginAlias = "testLoginAlias@testdomain.com";
@@ -129,17 +85,10 @@ public class TestAmbariLdapAuthoritiesPopulator extends EasyMockSupport {
PowerMock.replay(AuthorizationHelper.class);
AmbariLdapAuthoritiesPopulator populator = createMockBuilder(AmbariLdapAuthoritiesPopulator.class)
- .withConstructor(helper, userDAO, memberDAO, privilegeDAO).createMock();
+ .withConstructor(helper, userDAO, memberDAO, privilegeDAO, users).createMock();
- expect(userEntity.getPrincipal()).andReturn(principalEntity);
expect(userEntity.getActive()).andReturn(true);
- expect(memberDAO.findAllMembersByUser(userEntity)).andReturn(Collections.singletonList(memberEntity));
- expect(memberEntity.getGroup()).andReturn(groupEntity);
- expect(groupEntity.getPrincipal()).andReturn(groupPrincipalEntity);
- List<PrincipalEntity> principalEntityList = new LinkedList<PrincipalEntity>();
- principalEntityList.add(principalEntity);
- principalEntityList.add(groupPrincipalEntity);
- expect(privilegeDAO.findAllByPrincipal(principalEntityList)).andReturn(Collections.singletonList(privilegeEntity));
+ expect(users.getUserPrivileges(userEntity)).andReturn(Collections.singletonList(privilegeEntity));
expect(userDAO.findLdapUserByName(ambariUserName)).andReturn(userEntity); // user should be looked up by user name instead of login alias
[13/26] ambari git commit: AMBARI-19267. NN HA Namespace input
"jumps" when invalid value provided (onechiporenko)
Posted by nc...@apache.org.
AMBARI-19267. NN HA Namespace input "jumps" when invalid value provided (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0f2ec4f4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0f2ec4f4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0f2ec4f4
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 0f2ec4f45fd094397c5eeb5d6f84ce5ed4d3c2dc
Parents: 2b91ffd
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Wed Dec 21 15:33:49 2016 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Wed Dec 21 15:33:49 2016 +0200
----------------------------------------------------------------------
ambari-web/app/styles/wizard.less | 3 ---
.../admin/highAvailability/nameNode/step1.hbs | 26 ++++++++++++--------
.../test/controllers/main/host/details_test.js | 2 --
3 files changed, 16 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/0f2ec4f4/ambari-web/app/styles/wizard.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/wizard.less b/ambari-web/app/styles/wizard.less
index 49b6723..1398f12 100644
--- a/ambari-web/app/styles/wizard.less
+++ b/ambari-web/app/styles/wizard.less
@@ -334,9 +334,6 @@
margin-top: 10px;
margin-bottom: 10px;
}
- .nameserviceid-input {
- display: inline-block;
- }
}
#ha-step4 li, #ha-step6 li, #ha-step8 li, #mjn-step7 li {
http://git-wip-us.apache.org/repos/asf/ambari/blob/0f2ec4f4/ambari-web/app/templates/main/admin/highAvailability/nameNode/step1.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/highAvailability/nameNode/step1.hbs b/ambari-web/app/templates/main/admin/highAvailability/nameNode/step1.hbs
index f5087f9..db88b63 100644
--- a/ambari-web/app/templates/main/admin/highAvailability/nameNode/step1.hbs
+++ b/ambari-web/app/templates/main/admin/highAvailability/nameNode/step1.hbs
@@ -17,24 +17,30 @@
}}
<div id="ha-step1" class="wizard-content col-md-9">
<h4 class="step-title">{{t admin.highAvailability.wizard.step1.header}}</h4>
- <p class="step-description">
- {{t admin.highAvailability.wizard.step1.body}}
+ <div class="step-description">
+ <p>{{t admin.highAvailability.wizard.step1.body}}</p>
<div class="alert alert-warning">
{{t admin.highAvailability.wizard.step1.alert}}
{{#if controller.isHawqInstalled}}
{{{t admin.highAvailability.wizard.step1.hawq.alert}}}
{{/if}}
</div>
- </p>
+ </div>
<div class="panel panel-default">
<div class="panel-body">
- <div {{bindAttr class=":form-group view.showInputError:error view.showInputError:has-error :form-horizontal :nameserviceid-input"}}>
- <label class="control-label">{{t admin.highAvailability.wizard.step1.nameserviceid}}:</label>
- <div>
- {{view Ember.TextField valueBinding="content.nameServiceId" classNames="input-sm form-control"}}
- <span {{bindAttr class=":help-block :validation-block :col-sm-9 :pull-right view.showInputError::hidden"}}>
- {{t admin.highAvailability.wizard.step1.nameserviceid.error}}
- </span>
+ <div {{bindAttr class=":form-group view.showInputError:has-error :form-horizontal"}}>
+ <div class="row">
+ <div class="col-md-2">
+ <label class="control-label">{{t admin.highAvailability.wizard.step1.nameserviceid}}:</label>
+ </div>
+ <div class="col-md-3">
+ {{view Ember.TextField valueBinding="content.nameServiceId" classNames="form-control"}}
+ </div>
+ <div class="col-md-7">
+ <span {{bindAttr class=":help-block :validation-block view.showInputError::hidden"}}>
+ {{t admin.highAvailability.wizard.step1.nameserviceid.error}}
+ </span>
+ </div>
</div>
</div>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/0f2ec4f4/ambari-web/test/controllers/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js
index 4203644..cbebcf0 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -766,8 +766,6 @@ describe('App.MainHostDetailsController', function () {
describe('#showAddComponentPopup()', function () {
- var message = 'Comp1';
-
beforeEach(function () {
sinon.stub(App.ModalPopup, 'show');
});
[24/26] ambari git commit: AMBARI-19284. Zeppelin Notebook start
fails after reboot (aonishuk)
Posted by nc...@apache.org.
AMBARI-19284. Zeppelin Notebook start fails after reboot (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a100c0b3
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a100c0b3
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a100c0b3
Branch: refs/heads/branch-dev-patch-upgrade
Commit: a100c0b3ee1f480f4721586084de8f8d0639b6c0
Parents: 98a83c5
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Thu Dec 22 18:37:57 2016 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Thu Dec 22 18:37:57 2016 +0200
----------------------------------------------------------------------
.../ZEPPELIN/0.6.0.2.5/package/scripts/master.py | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a100c0b3/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py
index 39941f7..cfd6963 100644
--- a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py
+++ b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py
@@ -46,15 +46,6 @@ class Master(Script):
env.set_params(params)
self.install_packages(env)
- # create the pid and zeppelin dirs
- Directory([params.zeppelin_pid_dir, params.zeppelin_dir],
- owner=params.zeppelin_user,
- group=params.zeppelin_group,
- cd_access="a",
- create_parents=True,
- mode=0755
- )
-
if params.spark_version:
Execute('echo spark_version:' + str(params.spark_version) + ' detected for spark_home: '
+ params.spark_home + ' >> ' + params.zeppelin_log_file, user=params.zeppelin_user)
@@ -118,6 +109,15 @@ class Master(Script):
env.set_params(status_params)
self.create_zeppelin_log_dir(env)
+ # create the pid and zeppelin dirs
+ Directory([params.zeppelin_pid_dir, params.zeppelin_dir],
+ owner=params.zeppelin_user,
+ group=params.zeppelin_group,
+ cd_access="a",
+ create_parents=True,
+ mode=0755
+ )
+
# write out zeppelin-site.xml
XmlConfig("zeppelin-site.xml",
conf_dir=params.conf_dir,
[17/26] ambari git commit: AMBARI-19266. Command line support for
setting configuration options to support Kerberos token authentication.
(Laszlo Puskas via stoader)
Posted by nc...@apache.org.
AMBARI-19266. Command line support for setting configuration options to support Kerberos token authentication. (Laszlo Puskas via stoader)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/52d7b7ef
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/52d7b7ef
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/52d7b7ef
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 52d7b7ef624b8866428f0b0b5f3f8f5157193350
Parents: ae14380
Author: Laszlo Puskas <lp...@hortonworks.com>
Authored: Wed Dec 21 20:28:28 2016 +0100
Committer: Toader, Sebastian <st...@hortonworks.com>
Committed: Wed Dec 21 20:30:42 2016 +0100
----------------------------------------------------------------------
ambari-server/sbin/ambari-server | 6 +-
ambari-server/src/main/python/ambari-server.py | 14 ++-
.../main/python/ambari_server/kerberos_setup.py | 99 ++++++++++++++++++++
.../main/python/ambari_server/setupActions.py | 1 +
4 files changed, 117 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/52d7b7ef/ambari-server/sbin/ambari-server
----------------------------------------------------------------------
diff --git a/ambari-server/sbin/ambari-server b/ambari-server/sbin/ambari-server
index 8afabb1..5f97299 100755
--- a/ambari-server/sbin/ambari-server
+++ b/ambari-server/sbin/ambari-server
@@ -196,9 +196,13 @@ case "${1:-}" in
echo -e "Upgrading management pack"
$PYTHON "$AMBARI_PYTHON_EXECUTABLE" $@
;;
+ setup-kerberos)
+ echo -e "Setting up Kerberos authentication"
+ $PYTHON "$AMBARI_PYTHON_EXECUTABLE" $@
+ ;;
*)
echo "Usage: $AMBARI_EXECUTABLE
- {start|stop|reset|restart|upgrade|status|upgradestack|setup|setup-jce|setup-ldap|sync-ldap|set-current|setup-security|refresh-stack-hash|backup|restore|update-host-names|check-database|enable-stack|setup-sso|db-cleanup|install-mpack|uninstall-mpack|upgrade-mpack} [options]
+ {start|stop|reset|restart|upgrade|status|upgradestack|setup|setup-jce|setup-ldap|sync-ldap|set-current|setup-security|refresh-stack-hash|backup|restore|update-host-names|check-database|enable-stack|setup-sso|db-cleanup|install-mpack|uninstall-mpack|upgrade-mpack|setup-kerberos} [options]
Use $AMBARI_PYTHON_EXECUTABLE <action> --help to get details on options available.
Or, simply invoke ambari-server.py --help to print the options."
exit 1
http://git-wip-us.apache.org/repos/asf/ambari/blob/52d7b7ef/ambari-server/src/main/python/ambari-server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari-server.py b/ambari-server/src/main/python/ambari-server.py
index dff4fc3..5d4f5d7 100755
--- a/ambari-server/src/main/python/ambari-server.py
+++ b/ambari-server/src/main/python/ambari-server.py
@@ -52,9 +52,10 @@ from ambari_server.setupActions import BACKUP_ACTION, LDAP_SETUP_ACTION, LDAP_SY
SETUP_ACTION, SETUP_SECURITY_ACTION,START_ACTION, STATUS_ACTION, STOP_ACTION, RESTART_ACTION, UPGRADE_ACTION, \
UPGRADE_STACK_ACTION, SETUP_JCE_ACTION, SET_CURRENT_ACTION, START_ACTION, STATUS_ACTION, STOP_ACTION, UPGRADE_ACTION, \
UPGRADE_STACK_ACTION, SETUP_JCE_ACTION, SET_CURRENT_ACTION, ENABLE_STACK_ACTION, SETUP_SSO_ACTION, \
- DB_CLEANUP_ACTION, INSTALL_MPACK_ACTION, UNINSTALL_MPACK_ACTION, UPGRADE_MPACK_ACTION, PAM_SETUP_ACTION
+ DB_CLEANUP_ACTION, INSTALL_MPACK_ACTION, UNINSTALL_MPACK_ACTION, UPGRADE_MPACK_ACTION, PAM_SETUP_ACTION, KERBEROS_SETUP_ACTION
from ambari_server.setupSecurity import setup_ldap, sync_ldap, setup_master_key, setup_ambari_krb5_jaas, setup_pam
from ambari_server.userInput import get_validated_string_input
+from ambari_server.kerberos_setup import setup_kerberos
from ambari_server_main import server_process_main
from ambari_server.ambariPath import AmbariPath
@@ -587,6 +588,14 @@ def init_parser_options(parser):
parser.add_option('--jaas-principal', default=None, help="Kerberos principal for ambari server", dest="jaas_principal")
parser.add_option('--jaas-keytab', default=None, help="Keytab path for Kerberos principal", dest="jaas_keytab")
+ parser.add_option('--kerberos-setup', default=None, help="Setup Kerberos Authentication", dest="kerberos_setup")
+ parser.add_option('--kerberos-enabled', default=False, help="Kerberos enabled", dest="kerberos_enabled")
+ parser.add_option('--kerberos-spnego-principal', default="HTTP/_HOST", help="Kerberos SPNEGO principal", dest="kerberos_spnego_principal")
+ parser.add_option('--kerberos-spnego-keytab-file', default="/etc/security/keytabs/spnego.service.keytab", help="Kerberos SPNEGO keytab file", dest="kerberos_spnego_keytab_file")
+ parser.add_option('--kerberos-spnego-user-types', default="LDAP", help="User type search order (comma-delimited)", dest="kerberos_user_types")
+ parser.add_option('--kerberos-auth-to-local-rules', default="DEFAULT", help="Auth-to-local rules", dest="kerberos_auth_to_local_rules")
+
+
@OsFamilyFuncImpl(OSConst.WINSRV_FAMILY)
def are_cmd_line_db_args_blank(options):
if (options.database_host is None \
@@ -749,7 +758,8 @@ def create_user_action_map(args, options):
INSTALL_MPACK_ACTION: UserAction(install_mpack, options),
UNINSTALL_MPACK_ACTION: UserAction(uninstall_mpack, options),
UPGRADE_MPACK_ACTION: UserAction(upgrade_mpack, options),
- PAM_SETUP_ACTION: UserAction(setup_pam)
+ PAM_SETUP_ACTION: UserAction(setup_pam),
+ KERBEROS_SETUP_ACTION: UserAction(setup_kerberos, options)
}
return action_map
http://git-wip-us.apache.org/repos/asf/ambari/blob/52d7b7ef/ambari-server/src/main/python/ambari_server/kerberos_setup.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/kerberos_setup.py b/ambari-server/src/main/python/ambari_server/kerberos_setup.py
new file mode 100644
index 0000000..74b2d3e
--- /dev/null
+++ b/ambari-server/src/main/python/ambari_server/kerberos_setup.py
@@ -0,0 +1,99 @@
+#!/usr/bin/env python
+
+'''
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+'''
+
+import logging
+import pprint
+
+from ambari_server.serverConfiguration import get_value_from_properties, get_ambari_properties, update_properties_2
+from ambari_server.userInput import get_prompt_default,get_validated_string_input, get_YN_input
+from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
+from ambari_commons.exceptions import FatalException
+from ambari_commons.os_utils import is_root
+
+REGEX_TRUE_FALSE = "^(true|false)?$"
+REGEX_ANYTHING = ".*"
+
+logger = logging.getLogger(__name__)
+
+class KerberosPropertyTemplate:
+ def __init__(self, properties, i_option, i_prop_name, i_prop_val_pattern, i_prompt_regex, i_allow_empty_prompt, i_prop_name_default=None):
+ self.prop_name = i_prop_name
+ self.option = i_option
+ self.kerberos_prop_name = get_value_from_properties(properties, i_prop_name, i_prop_name_default)
+ self.kerberos_prop_val_prompt = i_prop_val_pattern.format(get_prompt_default(self.kerberos_prop_name))
+ self.prompt_regex = i_prompt_regex
+ self.allow_empty_prompt = i_allow_empty_prompt
+
+@OsFamilyFuncImpl(OsFamilyImpl.DEFAULT)
+def init_kerberos_properties_list(properties, options):
+ kerberos_properties = [
+ KerberosPropertyTemplate(properties, options.kerberos_enabled, "authentication.kerberos.enabled", "Enable Kerberos authentication [true|false] {0}: ",
+ REGEX_TRUE_FALSE, False, "false"),
+ KerberosPropertyTemplate(properties, options.kerberos_spnego_principal, "authentication.kerberos.spnego.principal", "SPNEGO principal {0}: ",
+ REGEX_ANYTHING, False, "HTTP/_HOST"),
+ KerberosPropertyTemplate(properties, options.kerberos_spnego_keytab_file, "authentication.kerberos.spnego.keytab.file", "SPNEGO keytab file {0}: ",
+ REGEX_ANYTHING, False, "/etc/security/keytabs/spnego.service.keytab"),
+ KerberosPropertyTemplate(properties, options.kerberos_user_types, "authentication.kerberos.user.types", "User type search order [LDAP|LOCAL|JTW] {0}: ",
+ REGEX_ANYTHING, False, "LDAP"),
+ KerberosPropertyTemplate(properties, options.kerberos_auth_to_local_rules, "authentication.kerberos.auth_to_local.rules", "Auth-to-local rules {0}: ",
+ REGEX_ANYTHING, False, "DEFAULT")
+ ]
+ return kerberos_properties
+
+def setup_kerberos(options):
+ logger.info("Setting up Kerberos authentication...")
+ if not is_root():
+ err = "ambari-server setup-kerberos should be run with root-level privileges"
+ raise FatalException(4, err)
+
+ properties = get_ambari_properties()
+ kerberos_property_list_required = init_kerberos_properties_list(properties, options)
+
+ kerberos_property_value_map = {}
+ for kerberos_property in kerberos_property_list_required:
+ input = get_validated_string_input(
+ kerberos_property.kerberos_prop_val_prompt,
+ kerberos_property.kerberos_prop_name,
+ kerberos_property.prompt_regex,
+ "Invalid characters in the input!",
+ False,
+ kerberos_property.allow_empty_prompt
+ )
+ if input is not None and input != "":
+ kerberos_property_value_map[kerberos_property.prop_name] = input
+
+ print "Properties to be updated / written into ambari properties:"
+ pp = pprint.PrettyPrinter()
+ pp.pprint(kerberos_property_value_map)
+
+
+ save = get_YN_input("Save settings [y/n] (y)? ", True)
+ if save:
+ update_properties_2(properties, kerberos_property_value_map)
+ print "Kerberos authentication settings successfully saved. Please restart the server in order for the new settings to take effect."
+ else:
+ print "Kerberos authentication settings aborted."
+
+ return 0;
+
+
+
+
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/52d7b7ef/ambari-server/src/main/python/ambari_server/setupActions.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/setupActions.py b/ambari-server/src/main/python/ambari_server/setupActions.py
index 7ea0752..358bfc9 100644
--- a/ambari-server/src/main/python/ambari_server/setupActions.py
+++ b/ambari-server/src/main/python/ambari_server/setupActions.py
@@ -48,3 +48,4 @@ INSTALL_MPACK_ACTION = "install-mpack"
UNINSTALL_MPACK_ACTION = "uninstall-mpack"
UPGRADE_MPACK_ACTION = "upgrade-mpack"
PAM_SETUP_ACTION = "setup-pam"
+KERBEROS_SETUP_ACTION = "setup-kerberos"
[20/26] ambari git commit: AMBARI-19279. AHW Configurations page
looks not like any other wizard page (onechiporenko)
Posted by nc...@apache.org.
AMBARI-19279. AHW Configurations page looks not like any other wizard page (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bd3df7db
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bd3df7db
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bd3df7db
Branch: refs/heads/branch-dev-patch-upgrade
Commit: bd3df7db06d43c78067df43e53209fd8aa1fac87
Parents: 170d3be
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Thu Dec 22 11:56:43 2016 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Thu Dec 22 11:56:43 2016 +0200
----------------------------------------------------------------------
.../app/templates/main/host/addHost/step4.hbs | 56 +++++++++++---------
1 file changed, 30 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/bd3df7db/ambari-web/app/templates/main/host/addHost/step4.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host/addHost/step4.hbs b/ambari-web/app/templates/main/host/addHost/step4.hbs
index 305b5f4..41e4381 100644
--- a/ambari-web/app/templates/main/host/addHost/step4.hbs
+++ b/ambari-web/app/templates/main/host/addHost/step4.hbs
@@ -15,20 +15,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
}}
-<div>
- <h2>{{t addHost.step4.header}}</h2>
- <div class="alert alert-info">
- {{t addHost.step4.title}}
- </div>
- <div class="pre-scrollable">
- <table class="table table-hover" id="host-configurations-table">
- <thead>
+<div class="wizard-content col-md-9">
+ <h4 class="step-title">{{t addHost.step4.header}}</h4>
+ <p class="step-description">{{t addHost.step4.title}}</p>
+ <div class="panel panel-default">
+ <div class="panel-body">
+ <div class="pre-scrollable">
+ <table class="table table-hover" id="host-configurations-table">
+ <thead>
<tr>
<th>{{t common.service}}</th>
<th>{{t common.conf.group}}</th>
</tr>
- </thead>
- <tbody>
+ </thead>
+ <tbody>
{{#each service in controller.content.configGroups}}
<tr {{bindAttr id="service.serviceId"}}>
<td>{{service.displayName}}</td>
@@ -44,21 +44,25 @@
</td>
</tr>
{{/each}}
- </tbody>
- </table>
- </div>
- <div class="btn-area">
- <button class="btn btn-default" {{bindAttr disabled="App.router.btnClickInProgress"}} {{action back}}>
- ← {{t common.back}}
- {{#if App.router.backBtnClickInProgress}}
- {{view App.SpinnerView tagName="span" classNames="service-button-spinner"}}
- {{/if}}
- </button>
- <button class="btn btn-success pull-right" {{bindAttr disabled="App.router.btnClickInProgress"}} {{action next}}>
- {{#if App.router.nextBtnClickInProgress}}
- {{view App.SpinnerView tagName="span" classNames="service-button-spinner"}}
- {{/if}}
- {{t common.next}} →
- </button>
+ </tbody>
+ </table>
+ </div>
</div>
+ </div>
</div>
+
+<div class="wizard-footer col-md-12 btn-area">
+ <button class="btn btn-default" {{bindAttr disabled="App.router.btnClickInProgress"}} {{action back}}>
+ ← {{t common.back}}
+ {{#if App.router.backBtnClickInProgress}}
+ {{view App.SpinnerView tagName="span" classNames="service-button-spinner"}}
+ {{/if}}
+ </button>
+ <button
+ class="btn btn-success pull-right" {{bindAttr disabled="App.router.btnClickInProgress"}} {{action next}}>
+ {{#if App.router.nextBtnClickInProgress}}
+ {{view App.SpinnerView tagName="span" classNames="service-button-spinner"}}
+ {{/if}}
+ {{t common.next}} →
+ </button>
+</div>
\ No newline at end of file
[11/26] ambari git commit: AMBARI-19261 : AMS cannot start after NN
HA is enabled due to hbase.rootdir pointing to Standby NN. (avijayan)
Posted by nc...@apache.org.
AMBARI-19261 : AMS cannot start after NN HA is enabled due to hbase.rootdir pointing to Standby NN. (avijayan)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/02f649fe
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/02f649fe
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/02f649fe
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 02f649fe0ed2e305fb44005e4f29527a5fd973f6
Parents: 1584984e
Author: Aravindan Vijayan <av...@hortonworks.com>
Authored: Tue Dec 20 15:43:18 2016 -0800
Committer: Aravindan Vijayan <av...@hortonworks.com>
Committed: Tue Dec 20 15:43:18 2016 -0800
----------------------------------------------------------------------
.../src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py | 2 +-
.../src/test/python/stacks/2.2/common/test_stack_advisor.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/02f649fe/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
index 5e8673c..a352cdb 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
@@ -754,7 +754,7 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
putAmsHbaseSiteProperty("hbase.tmp.dir", tmpDir)
if operatingMode == "distributed":
- putAmsHbaseSiteProperty("hbase.rootdir", defaultFs + "/user/ams/hbase")
+ putAmsHbaseSiteProperty("hbase.rootdir", "/user/ams/hbase")
if operatingMode == "embedded":
if isLocalRootDir:
http://git-wip-us.apache.org/repos/asf/ambari/blob/02f649fe/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
index 54349a2..beebe28 100644
--- a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
@@ -2524,7 +2524,7 @@ class TestHDP22StackAdvisor(TestCase):
services["configurations"]['ams-site']['properties']['timeline.metrics.service.operation.mode'] = 'distributed'
services["configurations"]["core-site"]["properties"]["fs.defaultFS"] = 'hdfs://host1:8020'
expected['ams-hbase-site']['properties']['hbase.cluster.distributed'] = 'true'
- expected['ams-hbase-site']['properties']['hbase.rootdir'] = 'hdfs://host1:8020/user/ams/hbase'
+ expected['ams-hbase-site']['properties']['hbase.rootdir'] = '/user/ams/hbase'
expected['ams-hbase-site']['properties']['hbase.zookeeper.property.clientPort'] = '2181'
expected['ams-hbase-env']['properties']['hbase_master_heapsize'] = '512'
expected['ams-hbase-site']['properties']['dfs.client.read.shortcircuit'] = 'true'
[18/26] ambari git commit: AMBARI-19228 : Knox doesn't redirect to
Atlas after entering correct credentials. (Vishal Suvagia via mugdha)
Posted by nc...@apache.org.
AMBARI-19228 : Knox doesn't redirect to Atlas after entering correct credentials. (Vishal Suvagia via mugdha)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b9271c30
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b9271c30
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b9271c30
Branch: refs/heads/branch-dev-patch-upgrade
Commit: b9271c30824cadd70f4244367f8ea5f4b4e9db8d
Parents: 52d7b7e
Author: Vishal Suvagia <vi...@yahoo.com>
Authored: Sat Dec 17 02:29:07 2016 +0530
Committer: Mugdha Varadkar <mu...@apache.org>
Committed: Thu Dec 22 10:36:17 2016 +0530
----------------------------------------------------------------------
.../common-services/ATLAS/0.1.0.2.3/package/scripts/params.py | 6 ++++++
.../services/ATLAS/configuration/application-properties.xml | 3 ++-
.../stacks/HDP/2.6/services/ATLAS/themes/theme_version_2.json | 2 +-
3 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/b9271c30/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
index a295915..f565968 100644
--- a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
@@ -140,6 +140,12 @@ metadata_server_host = atlas_hosts[0] if len(atlas_hosts) > 0 else "UNKNOWN_HOST
application_properties = dict(config['configurations']['application-properties'])
application_properties["atlas.server.bind.address"] = metadata_host
+# trimming knox_key
+if 'atlas.sso.knox.publicKey' in application_properties:
+ knox_key = application_properties['atlas.sso.knox.publicKey']
+ knox_key_without_new_line = knox_key.replace("\n","")
+ application_properties['atlas.sso.knox.publicKey'] = knox_key_without_new_line
+
if check_stack_feature(StackFeature.ATLAS_UPGRADE_SUPPORT, version_for_stack_feature_checks):
metadata_server_url = application_properties["atlas.rest.address"]
else:
http://git-wip-us.apache.org/repos/asf/ambari/blob/b9271c30/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/configuration/application-properties.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/configuration/application-properties.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/configuration/application-properties.xml
index 0d6ee38..47e1fb5 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/configuration/application-properties.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/configuration/application-properties.xml
@@ -54,6 +54,7 @@
<value/>
<description/>
<value-attributes>
+ <type>multiline</type>
<empty-value-valid>true</empty-value-valid>
</value-attributes>
<on-ambari-upgrade add="true"/>
@@ -92,4 +93,4 @@
<on-ambari-upgrade add="true"/>
</property>
-</configuration>
\ No newline at end of file
+</configuration>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b9271c30/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/themes/theme_version_2.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/themes/theme_version_2.json b/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/themes/theme_version_2.json
index a5435e9..74d0b4e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/themes/theme_version_2.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/themes/theme_version_2.json
@@ -831,7 +831,7 @@
{
"config": "application-properties/atlas.sso.knox.publicKey",
"widget": {
- "type": "text-field"
+ "type": "text-area"
}
},
{
[04/26] ambari git commit: AMBARI-19225 Ambari server should prints
error messages to its log if it can't find property for given property
attribute type (dili)
Posted by nc...@apache.org.
AMBARI-19225 Ambari server should prints error messages to its log if it can't find property for given property attribute type (dili)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c01f4d80
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c01f4d80
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c01f4d80
Branch: refs/heads/branch-dev-patch-upgrade
Commit: c01f4d809dfd4134fa789fd0496d73877117ba14
Parents: 64f3b39
Author: Di Li <di...@apache.org>
Authored: Tue Dec 20 12:01:13 2016 -0500
Committer: Di Li <di...@apache.org>
Committed: Tue Dec 20 12:01:13 2016 -0500
----------------------------------------------------------------------
.../org/apache/ambari/server/state/ConfigHelper.java | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/c01f4d80/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
index 54752f9..7e75469 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
@@ -551,7 +551,18 @@ public class ConfigHelper {
if (serviceProperty.getPropertyTypes().contains(propertyType)) {
String stackPropertyConfigType = fileNameToConfigType(serviceProperty.getFilename());
try {
- result.add(actualConfigs.get(stackPropertyConfigType).getProperties().get(serviceProperty.getName()));
+ String property = actualConfigs.get(stackPropertyConfigType).getProperties().get(serviceProperty.getName());
+ if (null == property){
+ LOG.error(String.format("Unable to obtain property values for %s with property attribute %s. "
+ + "The property does not exist in version %s of %s configuration.",
+ serviceProperty.getName(),
+ propertyType,
+ desiredConfigs.get(stackPropertyConfigType),
+ stackPropertyConfigType
+ ));
+ } else {
+ result.add(property);
+ }
} catch (Exception ignored) {
}
}
[19/26] ambari git commit: AMBARI-19265 Zeppelin fails to install
when hive-site.xml does not exist in spark conf directory (r-kamath)
Posted by nc...@apache.org.
AMBARI-19265 Zeppelin fails to install when hive-site.xml does not exist in spark conf directory (r-kamath)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/170d3bef
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/170d3bef
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/170d3bef
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 170d3bef601da41952e466d49147e8772d5fa303
Parents: b9271c3
Author: Renjith Kamath <re...@gmail.com>
Authored: Thu Dec 22 12:43:25 2016 +0530
Committer: Renjith Kamath <re...@gmail.com>
Committed: Thu Dec 22 12:44:05 2016 +0530
----------------------------------------------------------------------
.../common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py | 3 ---
1 file changed, 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/170d3bef/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py
index 0b79d37..39941f7 100644
--- a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py
+++ b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py
@@ -55,9 +55,6 @@ class Master(Script):
mode=0755
)
- # update the configs specified by user
- self.configure(env)
-
if params.spark_version:
Execute('echo spark_version:' + str(params.spark_version) + ' detected for spark_home: '
+ params.spark_home + ' >> ' + params.zeppelin_log_file, user=params.zeppelin_user)
[02/26] ambari git commit: AMBARI-19419. Code cleanup: unchecked
casts in *AuditEventBuilder (Attila Doroszlai via ncole)
Posted by nc...@apache.org.
AMBARI-19419. Code cleanup: unchecked casts in *AuditEventBuilder (Attila Doroszlai via ncole)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d1317dfb
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d1317dfb
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d1317dfb
Branch: refs/heads/branch-dev-patch-upgrade
Commit: d1317dfba2ea3499c2bf4d42daf0f2a278d1227f
Parents: 749a5b2
Author: Nate Cole <nc...@hortonworks.com>
Authored: Tue Dec 20 10:34:18 2016 -0500
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Tue Dec 20 10:34:18 2016 -0500
----------------------------------------------------------------------
.../server/audit/event/AbstractAuditEvent.java | 10 +++-
.../audit/event/AbstractUserAuditEvent.java | 8 ++-
.../event/AccessUnauthorizedAuditEvent.java | 4 ++
.../server/audit/event/LoginAuditEvent.java | 1 +
.../server/audit/event/LogoutAuditEvent.java | 1 +
.../audit/event/OperationStatusAuditEvent.java | 1 +
.../audit/event/TaskStatusAuditEvent.java | 1 +
.../kerberos/AbstractKerberosAuditEvent.java | 12 +++--
.../ChangeSecurityStateKerberosAuditEvent.java | 1 +
.../CreateKeyTabKerberosAuditEvent.java | 1 +
.../CreatePrincipalKerberosAuditEvent.java | 1 +
.../DestroyPrincipalKerberosAuditEvent.java | 1 +
.../request/ActivateUserRequestAuditEvent.java | 1 +
.../request/AddAlertGroupRequestAuditEvent.java | 1 +
.../AddAlertTargetRequestAuditEvent.java | 1 +
.../request/AddBlueprintRequestAuditEvent.java | 1 +
.../AddComponentToHostRequestAuditEvent.java | 1 +
.../request/AddCredentialRequestAuditEvent.java | 1 +
.../event/request/AddHostRequestAuditEvent.java | 1 +
.../request/AddRepositoryRequestAuditEvent.java | 1 +
.../AddRepositoryVersionRequestAuditEvent.java | 1 +
.../request/AddRequestRequestAuditEvent.java | 1 +
.../request/AddUpgradeRequestAuditEvent.java | 1 +
.../AddUserToGroupRequestAuditEvent.java | 1 +
.../AddViewInstanceRequestAuditEvent.java | 1 +
.../request/AdminUserRequestAuditEvent.java | 1 +
.../BlueprintExportRequestAuditEvent.java | 1 +
.../ChangeAlertGroupRequestAuditEvent.java | 1 +
.../ChangeAlertTargetRequestAuditEvent.java | 1 +
...hangeRepositoryVersionRequestAuditEvent.java | 1 +
.../ChangeViewInstanceRequestAuditEvent.java | 1 +
.../ClientConfigDownloadRequestAuditEvent.java | 1 +
.../ClusterNameChangeRequestAuditEvent.java | 1 +
...ClusterPrivilegeChangeRequestAuditEvent.java | 1 +
.../ConfigurationChangeRequestAuditEvent.java | 1 +
.../request/CreateGroupRequestAuditEvent.java | 1 +
.../request/CreateUserRequestAuditEvent.java | 1 +
.../event/request/DefaultRequestAuditEvent.java | 54 ++++++++++++++++++++
.../DeleteAlertGroupRequestAuditEvent.java | 1 +
.../DeleteAlertTargetRequestAuditEvent.java | 1 +
.../DeleteBlueprintRequestAuditEvent.java | 1 +
.../request/DeleteGroupRequestAuditEvent.java | 1 +
.../request/DeleteHostRequestAuditEvent.java | 1 +
...eleteRepositoryVersionRequestAuditEvent.java | 1 +
.../request/DeleteServiceRequestAuditEvent.java | 1 +
.../request/DeleteUserRequestAuditEvent.java | 1 +
.../DeleteViewInstanceRequestAuditEvent.java | 1 +
.../MembershipChangeRequestAuditEvent.java | 1 +
.../PrivilegeChangeRequestAuditEvent.java | 1 +
.../RemoveUserFromGroupRequestAuditEvent.java | 1 +
.../StartOperationRequestAuditEvent.java | 1 +
.../UpdateRepositoryRequestAuditEvent.java | 1 +
.../UpdateUpgradeItemRequestAuditEvent.java | 1 +
.../UserPasswordChangeRequestAuditEvent.java | 1 +
.../ViewPrivilegeChangeRequestAuditEvent.java | 1 +
.../server/audit/request/RequestAuditEvent.java | 31 ++++-------
.../eventcreator/DefaultEventCreator.java | 4 +-
57 files changed, 142 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/AbstractAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/AbstractAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/AbstractAuditEvent.java
index 558b0ea..cdf7455 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/AbstractAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/AbstractAuditEvent.java
@@ -47,7 +47,7 @@ public abstract class AbstractAuditEvent implements AuditEvent {
private Long timestamp;
private String auditMessage;
-
+ private final Class<? extends TBuilder> builderClass;
/**
* Creates a new audit event instance from this builder.
@@ -63,6 +63,9 @@ public abstract class AbstractAuditEvent implements AuditEvent {
*/
protected abstract void buildAuditMessage(StringBuilder builder);
+ protected AbstractAuditEventBuilder(Class<? extends TBuilder> builderClass) {
+ this.builderClass = builderClass;
+ }
/**
* The timestamp of the audit event.
@@ -73,7 +76,7 @@ public abstract class AbstractAuditEvent implements AuditEvent {
public TBuilder withTimestamp(Long timestamp) {
this.timestamp = timestamp;
- return (TBuilder) this;
+ return self();
}
/**
@@ -89,6 +92,9 @@ public abstract class AbstractAuditEvent implements AuditEvent {
return newAuditEvent();
}
+ protected TBuilder self() {
+ return builderClass.cast(this);
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/AbstractUserAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/AbstractUserAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/AbstractUserAuditEvent.java
index 6aab071..1edf22e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/AbstractUserAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/AbstractUserAuditEvent.java
@@ -40,6 +40,10 @@ public abstract class AbstractUserAuditEvent extends AbstractAuditEvent {
*/
private String remoteIp;
+ protected AbstractUserAuditEventBuilder(Class<? extends TBuilder> builderClass) {
+ super(builderClass);
+ }
+
/**
* Appends to audit event details the user name and remote ip of the host
* where user actions originates from.
@@ -65,7 +69,7 @@ public abstract class AbstractUserAuditEvent extends AbstractAuditEvent {
public TBuilder withUserName(String userName) {
this.userName = userName;
- return (TBuilder) this;
+ return self();
}
/**
@@ -77,7 +81,7 @@ public abstract class AbstractUserAuditEvent extends AbstractAuditEvent {
public TBuilder withRemoteIp(String ip) {
this.remoteIp = ip;
- return (TBuilder) this;
+ return self();
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/AccessUnauthorizedAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/AccessUnauthorizedAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/AccessUnauthorizedAuditEvent.java
index b6e60e1..94c668f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/AccessUnauthorizedAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/AccessUnauthorizedAuditEvent.java
@@ -39,6 +39,10 @@ public class AccessUnauthorizedAuditEvent extends AbstractUserAuditEvent {
*/
private String resourcePath;
+ private AccessUnauthorizedAuditEventBuilder() {
+ super(AccessUnauthorizedAuditEventBuilder.class);
+ }
+
/**
* Appends to the aduit event detail the list of the privileges
* possessed by the principal requesting access to a resource.
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/LoginAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/LoginAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/LoginAuditEvent.java
index 223dd18..9583b84 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/LoginAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/LoginAuditEvent.java
@@ -36,6 +36,7 @@ public class LoginAuditEvent extends AbstractUserAuditEvent {
extends AbstractUserAuditEventBuilder<LoginAuditEvent, LoginAuditEventBuilder> {
private LoginAuditEventBuilder() {
+ super(LoginAuditEventBuilder.class);
}
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/LogoutAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/LogoutAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/LogoutAuditEvent.java
index 3ce8c31..4aaeda3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/LogoutAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/LogoutAuditEvent.java
@@ -28,6 +28,7 @@ public class LogoutAuditEvent extends AbstractUserAuditEvent {
extends AbstractUserAuditEventBuilder<LogoutAuditEvent, LogoutAuditEventBuilder> {
private LogoutAuditEventBuilder() {
+ super(LogoutAuditEventBuilder.class);
}
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/OperationStatusAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/OperationStatusAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/OperationStatusAuditEvent.java
index fd0068e..65f1b42 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/OperationStatusAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/OperationStatusAuditEvent.java
@@ -50,6 +50,7 @@ public class OperationStatusAuditEvent extends AbstractAuditEvent {
private String userName;
private OperationStatusAuditEventBuilder() {
+ super(OperationStatusAuditEventBuilder.class);
}
@Override
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/TaskStatusAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/TaskStatusAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/TaskStatusAuditEvent.java
index 1682e74..890724c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/TaskStatusAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/TaskStatusAuditEvent.java
@@ -65,6 +65,7 @@ public class TaskStatusAuditEvent extends AbstractAuditEvent {
private String userName;
private TaskStatusAuditEventBuilder() {
+ super(TaskStatusAuditEventBuilder.class);
}
@Override
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/AbstractKerberosAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/AbstractKerberosAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/AbstractKerberosAuditEvent.java
index 3de4e48..709fe5e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/AbstractKerberosAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/AbstractKerberosAuditEvent.java
@@ -51,6 +51,10 @@ public class AbstractKerberosAuditEvent extends AbstractAuditEvent {
*/
protected Long taskId;
+ protected AbstractKerberosAuditEventBuilder(Class<? extends TBuilder> builderClass) {
+ super(builderClass);
+ }
+
/**
* Builds and audit log message based on the member variables
*
@@ -79,22 +83,22 @@ public class AbstractKerberosAuditEvent extends AbstractAuditEvent {
public TBuilder withOperation(String operation) {
this.operation = operation;
- return (TBuilder) this;
+ return self();
}
public TBuilder withReasonOfFailure(String reasonOfFailure) {
this.reasonOfFailure = reasonOfFailure;
- return (TBuilder) this;
+ return self();
}
public TBuilder withRequestId(Long requestId) {
this.requestId = requestId;
- return (TBuilder) this;
+ return self();
}
public TBuilder withTaskId(Long taskId) {
this.taskId = taskId;
- return (TBuilder) this;
+ return self();
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/ChangeSecurityStateKerberosAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/ChangeSecurityStateKerberosAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/ChangeSecurityStateKerberosAuditEvent.java
index ffb7e8a..a8dd01d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/ChangeSecurityStateKerberosAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/ChangeSecurityStateKerberosAuditEvent.java
@@ -49,6 +49,7 @@ public class ChangeSecurityStateKerberosAuditEvent extends AbstractKerberosAudit
private String state;
private ChangeSecurityStateKerberosAuditEventBuilder() {
+ super(ChangeSecurityStateKerberosAuditEventBuilder.class);
this.withOperation("Security state change");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/CreateKeyTabKerberosAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/CreateKeyTabKerberosAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/CreateKeyTabKerberosAuditEvent.java
index 7ac3ef4..8109135 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/CreateKeyTabKerberosAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/CreateKeyTabKerberosAuditEvent.java
@@ -44,6 +44,7 @@ public class CreateKeyTabKerberosAuditEvent extends AbstractKerberosAuditEvent {
private String principal;
private CreateKeyTabKerberosAuditEventBuilder() {
+ super(CreateKeyTabKerberosAuditEventBuilder.class);
this.withOperation("Keytab file creation");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/CreatePrincipalKerberosAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/CreatePrincipalKerberosAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/CreatePrincipalKerberosAuditEvent.java
index 51c3c6b..3692b35 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/CreatePrincipalKerberosAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/CreatePrincipalKerberosAuditEvent.java
@@ -28,6 +28,7 @@ public class CreatePrincipalKerberosAuditEvent extends AbstractKerberosAuditEven
private String principal;
private CreatePrincipalKerberosAuditEventBuilder() {
+ super(CreatePrincipalKerberosAuditEventBuilder.class);
this.withOperation("Principal creation");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/DestroyPrincipalKerberosAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/DestroyPrincipalKerberosAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/DestroyPrincipalKerberosAuditEvent.java
index 1e3dd36..981d82b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/DestroyPrincipalKerberosAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/DestroyPrincipalKerberosAuditEvent.java
@@ -34,6 +34,7 @@ public class DestroyPrincipalKerberosAuditEvent extends AbstractKerberosAuditEve
private String principal;
private DestroyPrincipalKerberosAuditEventBuilder() {
+ super(DestroyPrincipalKerberosAuditEventBuilder.class);
this.withOperation("Principal removal");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ActivateUserRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ActivateUserRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ActivateUserRequestAuditEvent.java
index c947fb1..765c988 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ActivateUserRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ActivateUserRequestAuditEvent.java
@@ -41,6 +41,7 @@ public class ActivateUserRequestAuditEvent extends RequestAuditEvent {
private String username;
public ActivateUserRequestAuditEventBuilder() {
+ super(ActivateUserRequestAuditEventBuilder.class);
super.withOperation("Set user active/inactive");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddAlertGroupRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddAlertGroupRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddAlertGroupRequestAuditEvent.java
index cd92ba0..3975110 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddAlertGroupRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddAlertGroupRequestAuditEvent.java
@@ -49,6 +49,7 @@ public class AddAlertGroupRequestAuditEvent extends RequestAuditEvent {
private List<String> notificationIds;
public AddAlertGroupRequestAuditEventBuilder() {
+ super(AddAlertGroupRequestAuditEventBuilder.class);
super.withOperation("Alert group addition");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddAlertTargetRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddAlertTargetRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddAlertTargetRequestAuditEvent.java
index 1c4a8d5..c9a5e74 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddAlertTargetRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddAlertTargetRequestAuditEvent.java
@@ -69,6 +69,7 @@ public class AddAlertTargetRequestAuditEvent extends RequestAuditEvent {
private List<String> alertStates;
public AddAlertTargetRequestAuditEventBuilder() {
+ super(AddAlertTargetRequestAuditEventBuilder.class);
super.withOperation("Notification addition");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddBlueprintRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddBlueprintRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddBlueprintRequestAuditEvent.java
index 84431ab..60433c5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddBlueprintRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddBlueprintRequestAuditEvent.java
@@ -36,6 +36,7 @@ public class AddBlueprintRequestAuditEvent extends RequestAuditEvent {
private String blueprintName;
public AddBlueprintRequestAuditEventBuilder() {
+ super(AddBlueprintRequestAuditEventBuilder.class);
super.withOperation("Upload blueprint");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddComponentToHostRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddComponentToHostRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddComponentToHostRequestAuditEvent.java
index c248665..bd4d3ab 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddComponentToHostRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddComponentToHostRequestAuditEvent.java
@@ -44,6 +44,7 @@ public class AddComponentToHostRequestAuditEvent extends RequestAuditEvent {
private Set<String> components;
public AddComponentToHostRequestAuditEventBuilder() {
+ super(AddComponentToHostRequestAuditEventBuilder.class);
super.withOperation("Component addition to host");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddCredentialRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddCredentialRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddCredentialRequestAuditEvent.java
index 5d27abf..6083b94 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddCredentialRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddCredentialRequestAuditEvent.java
@@ -51,6 +51,7 @@ public class AddCredentialRequestAuditEvent extends RequestAuditEvent {
private String alias;
public AddCredentialAuditEventBuilder() {
+ super(AddCredentialAuditEventBuilder.class);
super.withOperation("Credential addition");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddHostRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddHostRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddHostRequestAuditEvent.java
index c24175d..68c40c9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddHostRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddHostRequestAuditEvent.java
@@ -36,6 +36,7 @@ public class AddHostRequestAuditEvent extends RequestAuditEvent {
private String hostName;
public AddHostRequestAuditEventBuilder() {
+ super(AddHostRequestAuditEventBuilder.class);
super.withOperation("Host addition");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRepositoryRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRepositoryRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRepositoryRequestAuditEvent.java
index ed6c1cd..6ebaff4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRepositoryRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRepositoryRequestAuditEvent.java
@@ -56,6 +56,7 @@ public class AddRepositoryRequestAuditEvent extends RequestAuditEvent {
private String stackVersion;
public AddRepositoryRequestAuditEventBuilder() {
+ super(AddRepositoryRequestAuditEventBuilder.class);
super.withOperation("Repository addition");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRepositoryVersionRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRepositoryVersionRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRepositoryVersionRequestAuditEvent.java
index b4d3401..82207d2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRepositoryVersionRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRepositoryVersionRequestAuditEvent.java
@@ -60,6 +60,7 @@ public class AddRepositoryVersionRequestAuditEvent extends RequestAuditEvent {
private Map<String, List<Map<String, String>>> repos;
public AddRepositoryVersionAuditEventBuilder() {
+ super(AddRepositoryVersionAuditEventBuilder.class);
super.withOperation("Repository version addition");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRequestRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRequestRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRequestRequestAuditEvent.java
index 004c24a..2f88e34 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRequestRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRequestRequestAuditEvent.java
@@ -41,6 +41,7 @@ public class AddRequestRequestAuditEvent extends RequestAuditEvent {
private String clusterName;
public AddRequestAuditEventBuilder() {
+ super(AddRequestAuditEventBuilder.class);
super.withOperation("Request from server");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddUpgradeRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddUpgradeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddUpgradeRequestAuditEvent.java
index 69b4536..2c6df7b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddUpgradeRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddUpgradeRequestAuditEvent.java
@@ -47,6 +47,7 @@ public class AddUpgradeRequestAuditEvent extends RequestAuditEvent {
public AddUpgradeRequestAuditEventBuilder() {
+ super(AddUpgradeRequestAuditEventBuilder.class);
super.withOperation("Upgrade addition");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddUserToGroupRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddUserToGroupRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddUserToGroupRequestAuditEvent.java
index 33293c0..fa8b3b6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddUserToGroupRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddUserToGroupRequestAuditEvent.java
@@ -41,6 +41,7 @@ public class AddUserToGroupRequestAuditEvent extends RequestAuditEvent {
private String affectedUserName;
public AddUserToGroupRequestAuditEventBuilder() {
+ super(AddUserToGroupRequestAuditEventBuilder.class);
super.withOperation("User addition to group");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddViewInstanceRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddViewInstanceRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddViewInstanceRequestAuditEvent.java
index d9ab59a..8373168 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddViewInstanceRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddViewInstanceRequestAuditEvent.java
@@ -56,6 +56,7 @@ public class AddViewInstanceRequestAuditEvent extends RequestAuditEvent {
private String version;
public AddViewInstanceRequestAuditEventBuilder() {
+ super(AddViewInstanceRequestAuditEventBuilder.class);
super.withOperation("View addition");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AdminUserRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AdminUserRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AdminUserRequestAuditEvent.java
index a43d783..9666e59 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AdminUserRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AdminUserRequestAuditEvent.java
@@ -41,6 +41,7 @@ public class AdminUserRequestAuditEvent extends RequestAuditEvent {
private String username;
public AdminUserRequestAuditEventBuilder() {
+ super(AdminUserRequestAuditEventBuilder.class);
super.withOperation("Set user admin");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/BlueprintExportRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/BlueprintExportRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/BlueprintExportRequestAuditEvent.java
index e5ea1bd..b44caa7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/BlueprintExportRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/BlueprintExportRequestAuditEvent.java
@@ -31,6 +31,7 @@ public class BlueprintExportRequestAuditEvent extends RequestAuditEvent {
public static class BlueprintExportRequestAuditEventBuilder extends RequestAuditEventBuilder<BlueprintExportRequestAuditEvent, BlueprintExportRequestAuditEventBuilder> {
public BlueprintExportRequestAuditEventBuilder() {
+ super(BlueprintExportRequestAuditEventBuilder.class);
super.withOperation("Blueprint export");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeAlertGroupRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeAlertGroupRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeAlertGroupRequestAuditEvent.java
index d5a59df..97b677b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeAlertGroupRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeAlertGroupRequestAuditEvent.java
@@ -49,6 +49,7 @@ public class ChangeAlertGroupRequestAuditEvent extends RequestAuditEvent {
private List<String> notificationIds;
public ChangeAlertGroupRequestAuditEventBuilder() {
+ super(ChangeAlertGroupRequestAuditEventBuilder.class);
super.withOperation("Alert group change");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeAlertTargetRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeAlertTargetRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeAlertTargetRequestAuditEvent.java
index 63a45ca..227e90e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeAlertTargetRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeAlertTargetRequestAuditEvent.java
@@ -36,6 +36,7 @@ public class ChangeAlertTargetRequestAuditEvent extends RequestAuditEvent {
private List<String> alertStates;
public ChangeAlertTargetRequestAuditEventBuilder() {
+ super(ChangeAlertTargetRequestAuditEventBuilder.class);
super.withOperation("Notification change");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeRepositoryVersionRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeRepositoryVersionRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeRepositoryVersionRequestAuditEvent.java
index 702cd6f..fdba4eb 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeRepositoryVersionRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeRepositoryVersionRequestAuditEvent.java
@@ -61,6 +61,7 @@ public class ChangeRepositoryVersionRequestAuditEvent extends RequestAuditEvent
private SortedMap<String, List<Map<String, String>>> repos;
public ChangeRepositoryVersionAuditEventBuilder() {
+ super(ChangeRepositoryVersionAuditEventBuilder.class);
super.withOperation("Repository version change");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeViewInstanceRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeViewInstanceRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeViewInstanceRequestAuditEvent.java
index 4f719c6..e3a7363 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeViewInstanceRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeViewInstanceRequestAuditEvent.java
@@ -56,6 +56,7 @@ public class ChangeViewInstanceRequestAuditEvent extends RequestAuditEvent {
private String version;
public ChangeViewInstanceRequestAuditEventBuilder() {
+ super(ChangeViewInstanceRequestAuditEventBuilder.class);
super.withOperation("View change");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClientConfigDownloadRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClientConfigDownloadRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClientConfigDownloadRequestAuditEvent.java
index fd4071a..bdd35a1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClientConfigDownloadRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClientConfigDownloadRequestAuditEvent.java
@@ -41,6 +41,7 @@ public class ClientConfigDownloadRequestAuditEvent extends RequestAuditEvent {
private String component;
public ClientConfigDownloadRequestAuditEventBuilder() {
+ super(ClientConfigDownloadRequestAuditEventBuilder.class);
super.withOperation("Client config download");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClusterNameChangeRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClusterNameChangeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClusterNameChangeRequestAuditEvent.java
index c4ad139..183a70f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClusterNameChangeRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClusterNameChangeRequestAuditEvent.java
@@ -32,6 +32,7 @@ public class ClusterNameChangeRequestAuditEvent extends RequestAuditEvent {
private String newName;
public ClusterNameChangeRequestAuditEventBuilder() {
+ super(ClusterNameChangeRequestAuditEventBuilder.class);
super.withOperation("Cluster name change");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClusterPrivilegeChangeRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClusterPrivilegeChangeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClusterPrivilegeChangeRequestAuditEvent.java
index 29fb7b4..dab9719 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClusterPrivilegeChangeRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClusterPrivilegeChangeRequestAuditEvent.java
@@ -56,6 +56,7 @@ public class ClusterPrivilegeChangeRequestAuditEvent extends RequestAuditEvent {
private Map<String, List<String>> roles;
public ClusterPrivilegeChangeRequestAuditEventBuilder() {
+ super(ClusterPrivilegeChangeRequestAuditEventBuilder.class);
super.withOperation("Role change");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ConfigurationChangeRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ConfigurationChangeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ConfigurationChangeRequestAuditEvent.java
index d24c623..086c978 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ConfigurationChangeRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ConfigurationChangeRequestAuditEvent.java
@@ -41,6 +41,7 @@ public class ConfigurationChangeRequestAuditEvent extends RequestAuditEvent {
private String versionNote;
public ConfigurationChangeRequestAuditEventBuilder() {
+ super(ConfigurationChangeRequestAuditEventBuilder.class);
super.withOperation("Configuration change");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/CreateGroupRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/CreateGroupRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/CreateGroupRequestAuditEvent.java
index 5b4558c..db6c47d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/CreateGroupRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/CreateGroupRequestAuditEvent.java
@@ -36,6 +36,7 @@ public class CreateGroupRequestAuditEvent extends RequestAuditEvent {
private String groupName;
public CreateGroupRequestAuditEventBuilder() {
+ super(CreateGroupRequestAuditEventBuilder.class);
super.withOperation("Group creation");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/CreateUserRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/CreateUserRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/CreateUserRequestAuditEvent.java
index 95a5825..4cec906 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/CreateUserRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/CreateUserRequestAuditEvent.java
@@ -46,6 +46,7 @@ public class CreateUserRequestAuditEvent extends RequestAuditEvent {
private String username;
public CreateUserRequestAuditEventBuilder() {
+ super(CreateUserRequestAuditEventBuilder.class);
super.withOperation("User creation");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DefaultRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DefaultRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DefaultRequestAuditEvent.java
new file mode 100644
index 0000000..3bc4f04
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DefaultRequestAuditEvent.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.audit.event.request;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+import org.apache.ambari.server.audit.request.RequestAuditLogger;
+
+/**
+ * Default audit event for {@link RequestAuditLogger}.
+ */
+@Immutable
+public class DefaultRequestAuditEvent extends RequestAuditEvent {
+
+ public static class DefaultRequestAuditEventBuilder
+ extends RequestAuditEvent.RequestAuditEventBuilder<DefaultRequestAuditEvent, DefaultRequestAuditEventBuilder> {
+
+ private DefaultRequestAuditEventBuilder() {
+ super(DefaultRequestAuditEventBuilder.class);
+ }
+
+ @Override
+ protected DefaultRequestAuditEvent newAuditEvent() {
+ return new DefaultRequestAuditEvent(this);
+ }
+ }
+
+ protected DefaultRequestAuditEvent() {
+ }
+
+ private DefaultRequestAuditEvent(DefaultRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ public static DefaultRequestAuditEventBuilder builder() {
+ return new DefaultRequestAuditEventBuilder();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteAlertGroupRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteAlertGroupRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteAlertGroupRequestAuditEvent.java
index d78886b..541f6c1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteAlertGroupRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteAlertGroupRequestAuditEvent.java
@@ -36,6 +36,7 @@ public class DeleteAlertGroupRequestAuditEvent extends RequestAuditEvent {
private String id;
public DeleteAlertGroupRequestAuditEventBuilder() {
+ super(DeleteAlertGroupRequestAuditEventBuilder.class);
super.withOperation("Alert group removal");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteAlertTargetRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteAlertTargetRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteAlertTargetRequestAuditEvent.java
index 098cdc7..a5b75a5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteAlertTargetRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteAlertTargetRequestAuditEvent.java
@@ -36,6 +36,7 @@ public class DeleteAlertTargetRequestAuditEvent extends RequestAuditEvent {
private String id;
public DeleteAlertTargetRequestAuditEventBuilder() {
+ super(DeleteAlertTargetRequestAuditEventBuilder.class);
super.withOperation("Notification removal");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteBlueprintRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteBlueprintRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteBlueprintRequestAuditEvent.java
index 203f684..76559ad 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteBlueprintRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteBlueprintRequestAuditEvent.java
@@ -36,6 +36,7 @@ public class DeleteBlueprintRequestAuditEvent extends RequestAuditEvent {
private String blueprintName;
public DeleteBlueprintRequestAuditEventBuilder() {
+ super(DeleteBlueprintRequestAuditEventBuilder.class);
super.withOperation("Delete blueprint");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteGroupRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteGroupRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteGroupRequestAuditEvent.java
index b348508..acfee41 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteGroupRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteGroupRequestAuditEvent.java
@@ -36,6 +36,7 @@ public class DeleteGroupRequestAuditEvent extends RequestAuditEvent {
private String groupName;
public DeleteGroupRequestAuditEventBuilder() {
+ super(DeleteGroupRequestAuditEventBuilder.class);
super.withOperation("Group delete");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteHostRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteHostRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteHostRequestAuditEvent.java
index 27769ff..162b9c5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteHostRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteHostRequestAuditEvent.java
@@ -36,6 +36,7 @@ public class DeleteHostRequestAuditEvent extends RequestAuditEvent {
private String hostName;
public DeleteHostRequestAuditEventBuilder() {
+ super(DeleteHostRequestAuditEventBuilder.class);
super.withOperation("Host deletion");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteRepositoryVersionRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteRepositoryVersionRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteRepositoryVersionRequestAuditEvent.java
index 4937087..7b2a256 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteRepositoryVersionRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteRepositoryVersionRequestAuditEvent.java
@@ -46,6 +46,7 @@ public class DeleteRepositoryVersionRequestAuditEvent extends RequestAuditEvent
private String repoVersion;
public DeleteRepositoryVersionAuditEventBuilder() {
+ super(DeleteRepositoryVersionAuditEventBuilder.class);
super.withOperation("Repository version removal");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteServiceRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteServiceRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteServiceRequestAuditEvent.java
index 14ec72e..ce59e34 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteServiceRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteServiceRequestAuditEvent.java
@@ -36,6 +36,7 @@ public class DeleteServiceRequestAuditEvent extends RequestAuditEvent {
private String serviceName;
public DeleteServiceRequestAuditEventBuilder() {
+ super(DeleteServiceRequestAuditEventBuilder.class);
super.withOperation("Service deletion");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteUserRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteUserRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteUserRequestAuditEvent.java
index 1415518..e68aa1e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteUserRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteUserRequestAuditEvent.java
@@ -36,6 +36,7 @@ public class DeleteUserRequestAuditEvent extends RequestAuditEvent {
private String username;
public DeleteUserRequestAuditEventBuilder() {
+ super(DeleteUserRequestAuditEventBuilder.class);
super.withOperation("User delete");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteViewInstanceRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteViewInstanceRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteViewInstanceRequestAuditEvent.java
index d3173ec..3440d6d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteViewInstanceRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteViewInstanceRequestAuditEvent.java
@@ -46,6 +46,7 @@ public class DeleteViewInstanceRequestAuditEvent extends RequestAuditEvent {
private String version;
public DeleteViewInstanceRequestAuditEventBuilder() {
+ super(DeleteViewInstanceRequestAuditEventBuilder.class);
super.withOperation("View deletion");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/MembershipChangeRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/MembershipChangeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/MembershipChangeRequestAuditEvent.java
index 8bfe9cd..ad82617 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/MembershipChangeRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/MembershipChangeRequestAuditEvent.java
@@ -44,6 +44,7 @@ public class MembershipChangeRequestAuditEvent extends RequestAuditEvent {
private String groupName;
public AddUserToGroupRequestAuditEventBuilder() {
+ super(AddUserToGroupRequestAuditEventBuilder.class);
super.withOperation("Membership change");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/PrivilegeChangeRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/PrivilegeChangeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/PrivilegeChangeRequestAuditEvent.java
index b6c9002..c4a259f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/PrivilegeChangeRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/PrivilegeChangeRequestAuditEvent.java
@@ -46,6 +46,7 @@ public class PrivilegeChangeRequestAuditEvent extends RequestAuditEvent {
private String role;
public PrivilegeChangeRequestAuditEventBuilder() {
+ super(PrivilegeChangeRequestAuditEventBuilder.class);
super.withOperation("Role change");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/RemoveUserFromGroupRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/RemoveUserFromGroupRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/RemoveUserFromGroupRequestAuditEvent.java
index b1169ad..3fb9087 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/RemoveUserFromGroupRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/RemoveUserFromGroupRequestAuditEvent.java
@@ -41,6 +41,7 @@ public class RemoveUserFromGroupRequestAuditEvent extends RequestAuditEvent {
private String affectedUserName;
public AddUserToGroupRequestAuditEventBuilder() {
+ super(AddUserToGroupRequestAuditEventBuilder.class);
super.withOperation("User removal from group");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/StartOperationRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/StartOperationRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/StartOperationRequestAuditEvent.java
index eb92480..f685461 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/StartOperationRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/StartOperationRequestAuditEvent.java
@@ -53,6 +53,7 @@ public class StartOperationRequestAuditEvent extends AbstractUserAuditEvent {
private String hostname;
private StartOperationAuditEventBuilder() {
+ super(StartOperationAuditEventBuilder.class);
}
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateRepositoryRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateRepositoryRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateRepositoryRequestAuditEvent.java
index ea3a0de..ad614aa 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateRepositoryRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateRepositoryRequestAuditEvent.java
@@ -56,6 +56,7 @@ public class UpdateRepositoryRequestAuditEvent extends RequestAuditEvent {
private String stackVersion;
public UpdateRepositoryRequestAuditEventBuilder() {
+ super(UpdateRepositoryRequestAuditEventBuilder.class);
super.withOperation("Repository update");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateUpgradeItemRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateUpgradeItemRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateUpgradeItemRequestAuditEvent.java
index 3475f0a..3fa312e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateUpgradeItemRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateUpgradeItemRequestAuditEvent.java
@@ -47,6 +47,7 @@ public class UpdateUpgradeItemRequestAuditEvent extends RequestAuditEvent {
public UpdateUpgradeItemRequestAuditEventBuilder() {
+ super(UpdateUpgradeItemRequestAuditEventBuilder.class);
super.withOperation("Action confirmation by the user");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UserPasswordChangeRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UserPasswordChangeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UserPasswordChangeRequestAuditEvent.java
index 64a5aa1..08c0c36 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UserPasswordChangeRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UserPasswordChangeRequestAuditEvent.java
@@ -36,6 +36,7 @@ public class UserPasswordChangeRequestAuditEvent extends RequestAuditEvent {
private String username;
public UserPasswordChangeRequestAuditEventBuilder() {
+ super(UserPasswordChangeRequestAuditEventBuilder.class);
super.withOperation("Password change");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ViewPrivilegeChangeRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ViewPrivilegeChangeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ViewPrivilegeChangeRequestAuditEvent.java
index 73c1aa6..f282b28 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ViewPrivilegeChangeRequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ViewPrivilegeChangeRequestAuditEvent.java
@@ -69,6 +69,7 @@ public class ViewPrivilegeChangeRequestAuditEvent extends RequestAuditEvent {
public ViewPrivilegeChangeRequestAuditEventBuilder() {
+ super(ViewPrivilegeChangeRequestAuditEventBuilder.class);
super.withOperation("View permission change");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/request/RequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/RequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/RequestAuditEvent.java
index 200ecfa..6b94b8a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/RequestAuditEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/RequestAuditEvent.java
@@ -25,9 +25,10 @@ import org.apache.ambari.server.audit.event.AbstractUserAuditEvent;
/**
* Base class for start operation audit events.
*/
-public class RequestAuditEvent extends AbstractUserAuditEvent {
+public abstract class RequestAuditEvent extends AbstractUserAuditEvent {
- public static class RequestAuditEventBuilder<T extends RequestAuditEvent, TBuilder extends RequestAuditEventBuilder<T, TBuilder>> extends AbstractUserAuditEventBuilder<T, TBuilder> {
+ public abstract static class RequestAuditEventBuilder<T extends RequestAuditEvent, TBuilder extends RequestAuditEventBuilder<T, TBuilder>>
+ extends AbstractUserAuditEventBuilder<T, TBuilder> {
/**
* Request type (PUT, POST, DELETE, etc...)
@@ -49,12 +50,8 @@ public class RequestAuditEvent extends AbstractUserAuditEvent {
*/
private String operation;
- /**
- * {@inheritDoc}
- */
- @Override
- protected T newAuditEvent() {
- return (T) new RequestAuditEvent(this);
+ protected RequestAuditEventBuilder(Class<? extends TBuilder> builderClass) {
+ super(builderClass);
}
/**
@@ -99,7 +96,7 @@ public class RequestAuditEvent extends AbstractUserAuditEvent {
public TBuilder withRequestType(Request.Type requestType) {
this.requestType = requestType;
- return (TBuilder) this;
+ return self();
}
/**
@@ -111,7 +108,7 @@ public class RequestAuditEvent extends AbstractUserAuditEvent {
public TBuilder withUrl(String url) {
this.url = url;
- return (TBuilder) this;
+ return self();
}
/**
@@ -123,7 +120,7 @@ public class RequestAuditEvent extends AbstractUserAuditEvent {
public TBuilder withResultStatus(ResultStatus resultStatus) {
this.resultStatus = resultStatus;
- return (TBuilder) this;
+ return self();
}
/**
@@ -135,7 +132,7 @@ public class RequestAuditEvent extends AbstractUserAuditEvent {
public TBuilder withOperation(String operation) {
this.operation = operation;
- return (TBuilder) this;
+ return self();
}
}
@@ -149,13 +146,5 @@ public class RequestAuditEvent extends AbstractUserAuditEvent {
super(builder);
}
- /**
- * Returns an builder for {@link RequestAuditEvent}
- *
- * @return a builder instance
- */
- public static RequestAuditEventBuilder<?, ?> builder() {
- return new RequestAuditEventBuilder();
- }
-
}
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/d1317dfb/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/DefaultEventCreator.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/DefaultEventCreator.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/DefaultEventCreator.java
index 3ca2241..c32d82c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/DefaultEventCreator.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/DefaultEventCreator.java
@@ -25,7 +25,7 @@ import org.apache.ambari.server.api.services.Request;
import org.apache.ambari.server.api.services.Result;
import org.apache.ambari.server.api.services.ResultStatus;
import org.apache.ambari.server.audit.event.AuditEvent;
-import org.apache.ambari.server.audit.request.RequestAuditEvent;
+import org.apache.ambari.server.audit.event.request.DefaultRequestAuditEvent;
import org.apache.ambari.server.audit.request.RequestAuditLogger;
import org.apache.ambari.server.controller.spi.Resource;
@@ -72,7 +72,7 @@ public class DefaultEventCreator implements RequestAuditEventCreator {
@Override
public AuditEvent createAuditEvent(final Request request, final Result result) {
- return RequestAuditEvent.builder()
+ return DefaultRequestAuditEvent.builder()
.withTimestamp(System.currentTimeMillis())
.withRemoteIp(request.getRemoteAddress())
.withRequestType(request.getRequestType())
[07/26] ambari git commit: AMBARI-19117. Implement Create Alerts:
PORT alert configs page (step 2) (xiwang)
Posted by nc...@apache.org.
AMBARI-19117. Implement Create Alerts: PORT alert configs page (step 2) (xiwang)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/688830c6
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/688830c6
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/688830c6
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 688830c63f784588aa4c0b47a68c884df5fd5516
Parents: d48b8d9
Author: Xi Wang <xi...@apache.org>
Authored: Tue Nov 29 15:11:13 2016 -0800
Committer: Xi Wang <xi...@apache.org>
Committed: Tue Dec 20 10:31:10 2016 -0800
----------------------------------------------------------------------
ambari-web/app/config.js | 1 +
.../alert_definitions_actions_controller.js | 48 ++---
.../alerts/definition_configs_controller.js | 182 +++++++++++--------
ambari-web/app/models/alerts/alert_config.js | 34 ++--
ambari-web/app/styles/alerts.less | 2 +-
.../definitions_configs_controller_test.js | 76 +-------
6 files changed, 155 insertions(+), 188 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/688830c6/ambari-web/app/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/config.js b/ambari-web/app/config.js
index 130cb39..c7b41e6 100644
--- a/ambari-web/app/config.js
+++ b/ambari-web/app/config.js
@@ -90,6 +90,7 @@ App.supports = {
kerberosStackAdvisor: true,
logCountVizualization: false,
manageJournalNode: true,
+ createAlerts: false,
enabledWizardForHostOrderedUpgrade: true
};
http://git-wip-us.apache.org/repos/asf/ambari/blob/688830c6/ambari-web/app/controllers/main/alerts/alert_definitions_actions_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/alerts/alert_definitions_actions_controller.js b/ambari-web/app/controllers/main/alerts/alert_definitions_actions_controller.js
index 7fb4b2d..a397b7b 100644
--- a/ambari-web/app/controllers/main/alerts/alert_definitions_actions_controller.js
+++ b/ambari-web/app/controllers/main/alerts/alert_definitions_actions_controller.js
@@ -26,32 +26,36 @@ App.MainAlertDefinitionActionsController = Em.ArrayController.extend({
* List of available actions for alert definitions
* @type {{title: string, icon: string, action: string, showDivider: boolean}[]}
*/
- content: [
- {
- title: Em.I18n.t('alerts.actions.create'),
- icon: 'glyphicon glyphicon-plus',
- action: 'createNewAlertDefinition',
- showDivider: true
- },
- {
+ content: function() {
+ var content = [];
+ if (App.supports.createAlerts) {
+ content = [{
+ title: Em.I18n.t('alerts.actions.create'),
+ icon: 'glyphicon glyphicon-plus',
+ action: 'createNewAlertDefinition',
+ showDivider: true
+ }];
+ }
+ content = content.concat([{
title: Em.I18n.t('alerts.actions.manageGroups'),
icon: 'glyphicon glyphicon-th-large',
action: 'manageAlertGroups',
showDivider: false
- },
- {
- title: Em.I18n.t('alerts.actions.manageNotifications'),
- icon: 'glyphicon glyphicon-envelope',
- action: 'manageNotifications',
- showDivider: false
- },
- {
- title: Em.I18n.t('alerts.actions.manageSettings'),
- icon: 'glyphicon glyphicon-cog',
- action: 'manageSettings',
- showDivider: false
- }
- ],
+ },
+ {
+ title: Em.I18n.t('alerts.actions.manageNotifications'),
+ icon: 'glyphicon glyphicon-envelope',
+ action: 'manageNotifications',
+ showDivider: false
+ },
+ {
+ title: Em.I18n.t('alerts.actions.manageSettings'),
+ icon: 'glyphicon glyphicon-cog',
+ action: 'manageSettings',
+ showDivider: false
+ }]);
+ return content;
+ }.property('App.supports.createAlerts'),
/**
* Common handler for menu item click
http://git-wip-us.apache.org/repos/asf/ambari/blob/688830c6/ambari-web/app/controllers/main/alerts/definition_configs_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/alerts/definition_configs_controller.js b/ambari-web/app/controllers/main/alerts/definition_configs_controller.js
index 138aaa4..31e34a9 100644
--- a/ambari-web/app/controllers/main/alerts/definition_configs_controller.js
+++ b/ambari-web/app/controllers/main/alerts/definition_configs_controller.js
@@ -54,7 +54,7 @@ App.MainAlertDefinitionConfigsController = Em.Controller.extend({
* @type {Array}
*/
allServices: function () {
- return App.Service.find().mapProperty('displayName');
+ return App.Service.find().mapProperty('displayName').concat('CUSTOM');
}.property(),
/**
@@ -72,57 +72,60 @@ App.MainAlertDefinitionConfigsController = Em.Controller.extend({
}.property(),
/**
- * Change options of "Component", after changing value of "Service" config
+ * If any service selected, show related components, hide PORT and HOST field
+ * If CUSTOM was selected, show no component, and show PORT and HOST field
* @method onServiceSelect
*/
onServiceSelect: function () {
var serviceProperty = this.get('configs').findProperty('name', 'service');
- if (serviceProperty && serviceProperty.get('value') !== 'Ambari') {
- var componentsProperty = this.get('configs').findProperty('name', 'component');
+ var componentsProperty = this.get('configs').findProperty('name', 'component');
+ var defaultPortProperty = this.get('configs').findProperty('name', 'default_port');
+ var uriProperty = this.get('configs').findProperty('name', 'uri');
+ if (serviceProperty && serviceProperty.get('value') == 'CUSTOM') {
+ componentsProperty.set('options', ['No component']);
+ componentsProperty.set('canEdit', false);
+ var results = this.get('configs');
+ if (defaultPortProperty && uriProperty) {
+ results = results.filter(function (config) {
+ return config.name != 'default_port' && config.name != 'uri';
+ });
+ }
+ if (!defaultPortProperty) {
+ results = results.concat([
+ App.AlertConfigProperties.DefaultPort.create({
+ value: '8050'
+ }),
+ App.AlertConfigProperties.URI.create({
+ value: ''
+ })
+ ]);
+ this.set('configs', results);
+ }
+ } else if (serviceProperty && serviceProperty.get('value') !== 'CUSTOM' && componentsProperty.get('value') && componentsProperty.get('value') != 'No component') {
+ componentsProperty.set('options', ['No component'].concat(App.HostComponent.find().filterProperty('service.displayName', serviceProperty.get('value')).mapProperty('displayName').uniq()));
+ if (!defaultPortProperty) {
+ var results = this.get('configs').concat([
+ App.AlertConfigProperties.DefaultPort.create({
+ value: '8060'
+ }),
+ App.AlertConfigProperties.URI.create({
+ value: ''
+ })
+ ]);
+ this.set('configs', results);
+ }
+ } else if (serviceProperty && serviceProperty.get('value') !== 'CUSTOM') {
componentsProperty.set('options', ['No component'].concat(App.HostComponent.find().filterProperty('service.displayName', serviceProperty.get('value')).mapProperty('displayName').uniq()));
+ if (defaultPortProperty && uriProperty) {
+ var results = this.get('configs').filter(function (config) {
+ return config.name != 'default_port' && config.name != 'uri';
+ });
+ this.set('configs', results);
+ }
}
}.observes('configs.@each.value'),
/**
- * OnSelect handler for <code>select_type</code> property
- * disable fields related to definition type and set options to select lists
- */
- changeType: function (selectedType) {
- if (selectedType === 'alert_type_service') {
- this.get('configs').findProperty('name', 'service').setProperties({
- isDisabled: false,
- options: this.get('allServices'),
- value: this.get('allServices')[0]
- });
- this.get('configs').findProperty('name', 'component').setProperties({
- isDisabled: false,
- value: 'No component'
- });
- this.get('configs').findProperty('name', 'scope').setProperties({
- isDisabled: false,
- options: this.get('allScopes'),
- value: this.get('allScopes')[0]
- });
- } else {
- this.get('configs').findProperty('name', 'service').setProperties({
- isDisabled: true,
- options: ['Ambari'],
- value: 'Ambari'
- });
- this.get('configs').findProperty('name', 'component').setProperties({
- isDisabled: true,
- options: ['Ambari Agent'],
- value: 'Ambari Agent'
- });
- this.get('configs').findProperty('name', 'scope').setProperties({
- isDisabled: true,
- options: ['Host'],
- value: 'Host'
- });
- }
- },
-
- /**
* @return {string|Null}
* @method getThresholdsProperty
*/
@@ -185,34 +188,69 @@ App.MainAlertDefinitionConfigsController = Em.Controller.extend({
var isWizard = this.get('isWizard');
if (this.get('isWizard')) {
- result = result.concat(this.renderCommonWizardConfigs());
+ result = result.concat([
+ App.AlertConfigProperties.AlertName.create({
+ value: ''
+ }),
+ App.AlertConfigProperties.Service.create({
+ options: this.get('allServices'),
+ value: this.get('allServices')[0],
+ isShifted: true
+ }),
+ App.AlertConfigProperties.Component.create({
+ options: this.get('allComponents'),
+ value: 'No component',
+ isShifted: true
+ }),
+
+ //should be on next step
+ App.AlertConfigProperties.Interval.create({
+ value: isWizard ? '' : alertDefinition.get('interval')
+ }),
+ App.AlertConfigProperties.Thresholds.OkThreshold.create({
+ label: 'Thresholds',
+ showInputForValue: false,
+ text: isWizard ? '' : this.getThresholdsProperty('ok', 'text'),
+ value: isWizard ? '' : this.getThresholdsProperty('ok', 'value')
+ }),
+ App.AlertConfigProperties.Thresholds.WarningThreshold.create(App.AlertConfigProperties.Thresholds.PositiveMixin, {
+ valueMetric: 'Seconds',
+ text: isWizard ? '' : this.getThresholdsProperty('warning', 'text'),
+ value: isWizard ? '' : this.getThresholdsProperty('warning', 'value')
+ }),
+ App.AlertConfigProperties.Thresholds.CriticalThreshold.create(App.AlertConfigProperties.Thresholds.PositiveMixin, {
+ valueMetric: 'Seconds',
+ text: isWizard ? '' : this.getThresholdsProperty('critical', 'text'),
+ value: isWizard ? '' : this.getThresholdsProperty('critical', 'value')
+ })
+ ]);
+ } else {
+ result = result.concat([
+ App.AlertConfigProperties.Description.create({
+ value: isWizard ? '' : alertDefinition.get('description')
+ }),
+ App.AlertConfigProperties.Interval.create({
+ value: isWizard ? '' : alertDefinition.get('interval')
+ }),
+ App.AlertConfigProperties.Thresholds.OkThreshold.create({
+ label: 'Thresholds',
+ showInputForValue: false,
+ text: isWizard ? '' : this.getThresholdsProperty('ok', 'text'),
+ value: isWizard ? '' : this.getThresholdsProperty('ok', 'value')
+ }),
+ App.AlertConfigProperties.Thresholds.WarningThreshold.create(App.AlertConfigProperties.Thresholds.PositiveMixin, {
+ valueMetric: 'Seconds',
+ text: isWizard ? '' : this.getThresholdsProperty('warning', 'text'),
+ value: isWizard ? '' : this.getThresholdsProperty('warning', 'value')
+ }),
+ App.AlertConfigProperties.Thresholds.CriticalThreshold.create(App.AlertConfigProperties.Thresholds.PositiveMixin, {
+ valueMetric: 'Seconds',
+ text: isWizard ? '' : this.getThresholdsProperty('critical', 'text'),
+ value: isWizard ? '' : this.getThresholdsProperty('critical', 'value')
+ })
+ ]);
}
- result = result.concat([
- App.AlertConfigProperties.Description.create({
- value: isWizard ? '' : alertDefinition.get('description')
- }),
- App.AlertConfigProperties.Interval.create({
- value: isWizard ? '' : alertDefinition.get('interval')
- }),
- App.AlertConfigProperties.Thresholds.OkThreshold.create({
- label: 'Thresholds',
- showInputForValue: false,
- text: isWizard ? '' : this.getThresholdsProperty('ok', 'text'),
- value: isWizard ? '' : this.getThresholdsProperty('ok', 'value')
- }),
- App.AlertConfigProperties.Thresholds.WarningThreshold.create(App.AlertConfigProperties.Thresholds.PositiveMixin, {
- valueMetric: 'Seconds',
- text: isWizard ? '' : this.getThresholdsProperty('warning', 'text'),
- value: isWizard ? '' : this.getThresholdsProperty('warning', 'value')
- }),
- App.AlertConfigProperties.Thresholds.CriticalThreshold.create(App.AlertConfigProperties.Thresholds.PositiveMixin, {
- valueMetric: 'Seconds',
- text: isWizard ? '' : this.getThresholdsProperty('critical', 'text'),
- value: isWizard ? '' : this.getThresholdsProperty('critical', 'value')
- })
- ]);
-
return result;
},
@@ -558,9 +596,6 @@ App.MainAlertDefinitionConfigsController = Em.Controller.extend({
App.AlertConfigProperties.AlertName.create({
value: ''
}),
- App.AlertConfigProperties.ServiceAlertType.create({
- value: true
- }),
App.AlertConfigProperties.Service.create({
options: this.get('allServices'),
value: this.get('allServices')[0],
@@ -574,9 +609,6 @@ App.MainAlertDefinitionConfigsController = Em.Controller.extend({
App.AlertConfigProperties.Scope.create({
options: this.get('allScopes'),
isShifted: true
- }),
- App.AlertConfigProperties.HostAlertType.create({
- value: false
})
];
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/688830c6/ambari-web/app/models/alerts/alert_config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/alerts/alert_config.js b/ambari-web/app/models/alerts/alert_config.js
index 980dfe5..1af02fc 100644
--- a/ambari-web/app/models/alerts/alert_config.js
+++ b/ambari-web/app/models/alerts/alert_config.js
@@ -173,28 +173,18 @@ App.AlertConfigProperties = {
apiProperty: 'name'
}),
- ServiceAlertType: App.AlertConfigProperty.extend({
- name: 'alert_type_service',
- label: 'Service Alert Definition',
- displayType: 'radioButton',
- group: 'alert_type'
- }),
-
- HostAlertType: App.AlertConfigProperty.extend({
- name: 'alert_type_host',
- label: 'Host Alert Definition',
- displayType: 'radioButton',
- group: 'alert_type'
- }),
-
Service: App.AlertConfigProperty.extend({
name: 'service',
label: 'Service',
displayType: 'select',
apiProperty: 'service_name',
apiFormattedValue: function () {
- return App.StackService.find().findProperty('displayName', this.get('value')).get('serviceName');
- }.property('value')
+ return this.get('value') == 'CUSTOM' ? this.get('value') : App.StackService.find().findProperty('displayName', this.get('value')).get('serviceName');
+ }.property('value'),
+ change: function () {
+ this.set('property.value', true);
+ this.get('parentView.controller').changeService(this.get('property.name'));
+ }
}),
Component: App.AlertConfigProperty.extend({
@@ -203,7 +193,7 @@ App.AlertConfigProperties = {
displayType: 'select',
apiProperty: 'component_name',
apiFormattedValue: function () {
- return App.StackServiceComponent.find().findProperty('displayName', this.get('value')).get('componentName');
+ return this.get('value') == 'No component' ? this.get('value') : App.StackServiceComponent.find().findProperty('displayName', this.get('value')).get('componentName');
}.property('value')
}),
@@ -404,7 +394,7 @@ App.AlertConfigProperties = {
URI: App.AlertConfigProperty.extend({
name: 'uri',
- label: 'URI',
+ label: 'Host',
displayType: 'textField',
apiProperty: 'source.uri'
}),
@@ -429,7 +419,13 @@ App.AlertConfigProperties = {
name: 'default_port',
label: 'Default Port',
displayType: 'textField',
- apiProperty: 'source.default_port'
+ classNames: 'alert-port-input',
+ apiProperty: 'source.default_port',
+ isValid: function () {
+ var value = this.get('value');
+ if (!value) return false;
+ return String(value) === String(parseInt(value, 10)) && value >= 1;
+ }.property('value')
}),
Path: App.AlertConfigProperty.extend({
http://git-wip-us.apache.org/repos/asf/ambari/blob/688830c6/ambari-web/app/styles/alerts.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/alerts.less b/ambari-web/app/styles/alerts.less
index 77cc13c..a04db8a 100644
--- a/ambari-web/app/styles/alerts.less
+++ b/ambari-web/app/styles/alerts.less
@@ -524,7 +524,7 @@
.alert-type {
height: 150px;
width: 32%;
- margin: 5px;
+ margin: 0px 5px 10px 5px;
padding: 10px;
background: white;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/688830c6/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js b/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js
index 2ea42f7..d3294f9 100644
--- a/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js
+++ b/ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js
@@ -123,7 +123,7 @@ describe('App.MainAlertDefinitionConfigsController', function () {
it('isWizard = true', function () {
controller.set('isWizard', true);
var result = controller.renderPortConfigs();
- expect(result.length).to.equal(11);
+ expect(result.length).to.equal(7);
});
it('isWizard = false', function () {
@@ -180,7 +180,7 @@ describe('App.MainAlertDefinitionConfigsController', function () {
it('isWizard = true', function () {
controller.set('isWizard', true);
var result = controller.renderMetricConfigs();
- expect(result.length).to.equal(12);
+ expect(result.length).to.equal(10);
});
it('isWizard = false', function () {
@@ -229,7 +229,7 @@ describe('App.MainAlertDefinitionConfigsController', function () {
it('isWizard = true', function () {
controller.set('isWizard', true);
var result = controller.renderWebConfigs();
- expect(result.length).to.equal(12);
+ expect(result.length).to.equal(10);
});
it('isWizard = false', function () {
@@ -275,7 +275,7 @@ describe('App.MainAlertDefinitionConfigsController', function () {
it('isWizard = true', function () {
controller.set('isWizard', true);
var result = controller.renderScriptConfigs();
- expect(result.length).to.equal(10);
+ expect(result.length).to.equal(8);
});
it('isWizard = false', function () {
@@ -546,79 +546,13 @@ describe('App.MainAlertDefinitionConfigsController', function () {
});
- describe('#changeType()', function () {
-
- beforeEach(function () {
- controller.set('allServices', ['service1', 'service2']);
- controller.set('allScopes', ['scope1', 'scope2']);
-
- controller.set('configs', [
- Em.Object.create({name: 'service', isDisabled: false}),
- Em.Object.create({name: 'component', isDisabled: false}),
- Em.Object.create({name: 'scope', isDisabled: false})
- ]);
- });
-
- describe('Host Alert Definition', function () {
-
- beforeEach(function () {
- controller.changeType('Host Alert Definition');
- });
-
- it('all configs are disabled', function () {
- expect(controller.get('configs').everyProperty('isDisabled', true)).to.be.true;
- });
- it('service.options = ["Ambari"]', function () {
- expect(controller.get('configs').findProperty('name', 'service').get('options')).to.eql(['Ambari']);
- });
- it('service.value = "Ambari"', function () {
- expect(controller.get('configs').findProperty('name', 'service').get('value')).to.equal('Ambari');
- });
- it('component.value = "Ambari Agent"', function () {
- expect(controller.get('configs').findProperty('name', 'component').get('value')).to.equal('Ambari Agent');
- });
- it('scope.options = ["Host"]', function () {
- expect(controller.get('configs').findProperty('name', 'scope').get('options')).to.eql(['Host']);
- });
- it('isDisabled.value = "Host"', function () {
- expect(controller.get('configs').findProperty('name', 'scope').get('value')).to.equal('Host');
- });
- });
-
- describe('alert_type_service', function () {
-
- beforeEach(function () {
- controller.changeType('alert_type_service');
- });
- it('all configs are not disabled', function () {
- expect(controller.get('configs').everyProperty('isDisabled', false)).to.be.true;
- });
- it('service.options = ["service1", "service2"]', function () {
- expect(controller.get('configs').findProperty('name', 'service').get('options')).to.eql(['service1', 'service2']);
- });
- it('service.value = "service1"', function () {
- expect(controller.get('configs').findProperty('name', 'service').get('value')).to.equal('service1');
- });
- it('component.value = "No component"', function () {
- expect(controller.get('configs').findProperty('name', 'component').get('value')).to.equal('No component');
- });
- it('scope.options = ["scope1", "scope2"]', function () {
- expect(controller.get('configs').findProperty('name', 'scope').get('options')).to.eql(['scope1', 'scope2']);
- });
- it('scope.value = "scope1"', function () {
- expect(controller.get('configs').findProperty('name', 'scope').get('value')).to.equal('scope1');
- });
- });
-
- });
-
describe('#renderCommonWizardConfigs()', function () {
it('should return correct number of configs', function () {
var result = controller.renderCommonWizardConfigs();
- expect(result.length).to.equal(6);
+ expect(result.length).to.equal(4);
});
[16/26] ambari git commit: AMBARI-19260. Improve and Fix 'Dashboard
page' after new guidelines.(xiwang)
Posted by nc...@apache.org.
AMBARI-19260. Improve and Fix 'Dashboard page' after new guidelines.(xiwang)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ae143800
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ae143800
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ae143800
Branch: refs/heads/branch-dev-patch-upgrade
Commit: ae14380074bcc626e0c24d13a92db7d31e04c5f5
Parents: c08df0e
Author: Xi Wang <xi...@apache.org>
Authored: Tue Dec 20 15:48:28 2016 -0800
Committer: Xi Wang <xi...@apache.org>
Committed: Wed Dec 21 10:59:32 2016 -0800
----------------------------------------------------------------------
ambari-web/app/styles/application.less | 4 ++++
ambari-web/app/styles/dashboard.less | 21 +++++++++++++++-----
.../main/dashboard/plus_button_filter.hbs | 14 ++++---------
.../main/service/all_services_actions.hbs | 4 ++--
ambari-web/app/views/main/dashboard/widgets.js | 1 -
5 files changed, 26 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ae143800/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 4a50af7..c35f0d1 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -1331,6 +1331,10 @@ a:focus {
.icon-medkit {
padding-left:6px;
}
+
+ .services-menu-actions {
+ margin-left: 20%;
+ }
}
a.services-menu-blocks{
http://git-wip-us.apache.org/repos/asf/ambari/blob/ae143800/ambari-web/app/styles/dashboard.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/dashboard.less b/ambari-web/app/styles/dashboard.less
index 9e1213e..53e55b1 100644
--- a/ambari-web/app/styles/dashboard.less
+++ b/ambari-web/app/styles/dashboard.less
@@ -24,6 +24,12 @@
overflow: auto;
width: 210px;
}
+ .add-widgets-apply-button {
+ margin: 0px 20px 20px 0px;
+ }
+ .nothing-to-add {
+ padding: 5px 15px;
+ }
}
#dashboard-widgets {
@@ -104,7 +110,7 @@
}
}
.img-thumbnail .caption {
- padding: 7px 0;
+ padding: 7px 5px;
color: #555;
font-weight:bold;
font-size: 12px;
@@ -159,7 +165,7 @@
display: block;
}
.caption{
- margin-left: -10px;
+ margin-left: -14.5px;
z-index: 7;
}
.slots-caption{
@@ -223,22 +229,27 @@
z-index: 9;
}
.caption {
- margin-left: -10px;
+ margin-left: -14.5px;
}
}
}
.links .img-thumbnail{
li{
- height:20px;
+ height:24px;
}
.link-button{
float: right;
+ margin-top: 5px;
.disabled-hdfs-quick-link {
pointer-events: none;
color: #808080;
cursor: default;
}
+ button.btn {
+ font-size: 12px;
+ padding: 5px 10px;
+ }
}
.widget-content{
@@ -265,7 +276,7 @@
z-index: 9;
}
.caption{
- margin-left: -10px;
+ margin-left: -14.5px;
}
}
.img-thumbnail .widget-content .svg {
http://git-wip-us.apache.org/repos/asf/ambari/blob/ae143800/ambari-web/app/templates/main/dashboard/plus_button_filter.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/dashboard/plus_button_filter.hbs b/ambari-web/app/templates/main/dashboard/plus_button_filter.hbs
index 81420ff..88d5756 100644
--- a/ambari-web/app/templates/main/dashboard/plus_button_filter.hbs
+++ b/ambari-web/app/templates/main/dashboard/plus_button_filter.hbs
@@ -26,17 +26,11 @@
{{/each}}
</ul>
</li>
- <li>
- <button class="btn btn-default" {{action "closeFilter" target="view"}}>{{t common.cancel}}</button>
- <button class="btn btn-primary" {{action "applyFilter" target="view"}}>{{t common.apply}}</button>
+ <li class="add-widgets-apply-button">
+ <button class="btn btn-primary pull-right" {{action "applyFilter" target="view"}}>{{t common.add}}</button>
</li>
{{else}}
- <li>
- <ul>
- <li>{{t dashboard.widgets.nothing}}</li>
- </ul>
- </li>
- <li>
- <button class="btn btn-default" {{action "closeFilter" target="view"}}>{{t common.cancel}}</button>
+ <li class="nothing-to-add">
+ <span>{{t dashboard.widgets.nothing}}</span>
</li>
{{/if}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ae143800/ambari-web/app/templates/main/service/all_services_actions.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/service/all_services_actions.hbs b/ambari-web/app/templates/main/service/all_services_actions.hbs
index f2ce0fd..7cd36c8 100644
--- a/ambari-web/app/templates/main/service/all_services_actions.hbs
+++ b/ambari-web/app/templates/main/service/all_services_actions.hbs
@@ -18,8 +18,8 @@
<div class="row">
{{#isAuthorized "SERVICE.START_STOP, SERVICE.ADD_DELETE_SERVICES"}}
- <div class="dropdown">
- <button class="btn btn-default dropdown-toggle center-block" data-toggle="dropdown" href="#">{{t common.actions}}
+ <div class="dropdown services-menu-actions">
+ <button class="btn btn-default dropdown-toggle" data-toggle="dropdown" href="#">{{t common.actions}}
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
http://git-wip-us.apache.org/repos/asf/ambari/blob/ae143800/ambari-web/app/views/main/dashboard/widgets.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/widgets.js b/ambari-web/app/views/main/dashboard/widgets.js
index 4e22aad..0c6b7aa 100644
--- a/ambari-web/app/views/main/dashboard/widgets.js
+++ b/ambari-web/app/views/main/dashboard/widgets.js
@@ -465,7 +465,6 @@ App.MainDashboardWidgetsView = Em.View.extend(App.UserPref, App.LocalStorage, Ap
});
}
}),
- closeFilter: Em.K,
applyFilter: function () {
var parent = this.get('parentView'),
hiddenWidgets = this.get('hiddenWidgets'),
[03/26] ambari git commit: AMBARI-19226: Provide default value for
hdfs_tmp_dir parameter in params.py scripts (dili)
Posted by nc...@apache.org.
AMBARI-19226: Provide default value for hdfs_tmp_dir parameter in params.py scripts (dili)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/64f3b39b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/64f3b39b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/64f3b39b
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 64f3b39ba3bcef59cdca94b3b29dde37feb0e7f0
Parents: d1317df
Author: Di Li <di...@apache.org>
Authored: Tue Dec 20 11:36:15 2016 -0500
Committer: Di Li <di...@apache.org>
Committed: Tue Dec 20 11:36:15 2016 -0500
----------------------------------------------------------------------
.../common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py | 2 +-
.../common-services/HDFS/3.0.0.3.0/package/scripts/params_linux.py | 2 +-
.../common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py | 2 +-
.../common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py | 2 +-
.../stacks/HDP/2.0.6/hooks/before-START/scripts/params.py | 2 +-
.../resources/stacks/HDP/3.0/hooks/before-START/scripts/params.py | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/64f3b39b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py
index 7567ab4..b04fce3 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py
@@ -92,7 +92,7 @@ dfs_http_policy = default('/configurations/hdfs-site/dfs.http.policy', None)
dfs_dn_ipc_address = config['configurations']['hdfs-site']['dfs.datanode.ipc.address']
secure_dn_ports_are_in_use = False
-hdfs_tmp_dir = config['configurations']['hadoop-env']['hdfs_tmp_dir']
+hdfs_tmp_dir = default("/configurations/hadoop-env/hdfs_tmp_dir", "/tmp")
namenode_backup_dir = default("/configurations/hadoop-env/namenode_backup_dir", "/tmp/upgrades")
# hadoop default parameters
http://git-wip-us.apache.org/repos/asf/ambari/blob/64f3b39b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_linux.py
index 55544e0..512ca27 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_linux.py
@@ -89,7 +89,7 @@ dfs_http_policy = default('/configurations/hdfs-site/dfs.http.policy', None)
dfs_dn_ipc_address = config['configurations']['hdfs-site']['dfs.datanode.ipc.address']
secure_dn_ports_are_in_use = False
-hdfs_tmp_dir = config['configurations']['hadoop-env']['hdfs_tmp_dir']
+hdfs_tmp_dir = default("/configurations/hadoop-env/hdfs_tmp_dir", "/tmp")
namenode_backup_dir = default("/configurations/hadoop-env/namenode_backup_dir", "/tmp/upgrades")
# hadoop default parameters
http://git-wip-us.apache.org/repos/asf/ambari/blob/64f3b39b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
index bebb375..6bf2927 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
@@ -143,7 +143,7 @@ ulimit_cmd = "ulimit -c unlimited;"
mapred_user = status_params.mapred_user
yarn_user = status_params.yarn_user
hdfs_user = config['configurations']['hadoop-env']['hdfs_user']
-hdfs_tmp_dir = config['configurations']['hadoop-env']['hdfs_tmp_dir']
+hdfs_tmp_dir = default("/configurations/hadoop-env/hdfs_tmp_dir", "/tmp")
smokeuser = config['configurations']['cluster-env']['smokeuser']
smokeuser_principal = config['configurations']['cluster-env']['smokeuser_principal_name']
http://git-wip-us.apache.org/repos/asf/ambari/blob/64f3b39b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py
index cdadc80..52cc1c5 100644
--- a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py
@@ -143,7 +143,7 @@ ulimit_cmd = "ulimit -c unlimited;"
mapred_user = status_params.mapred_user
yarn_user = status_params.yarn_user
hdfs_user = config['configurations']['hadoop-env']['hdfs_user']
-hdfs_tmp_dir = config['configurations']['hadoop-env']['hdfs_tmp_dir']
+hdfs_tmp_dir = default("/configurations/hadoop-env/hdfs_tmp_dir", "/tmp")
smokeuser = config['configurations']['cluster-env']['smokeuser']
smokeuser_principal = config['configurations']['cluster-env']['smokeuser_principal_name']
http://git-wip-us.apache.org/repos/asf/ambari/blob/64f3b39b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
index daba3d3..b905c2b 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
@@ -44,7 +44,7 @@ dfs_type = default("/commandParams/dfs_type", "")
hadoop_conf_dir = "/etc/hadoop/conf"
component_list = default("/localComponents", [])
-hdfs_tmp_dir = config['configurations']['hadoop-env']['hdfs_tmp_dir']
+hdfs_tmp_dir = default("/configurations/hadoop-env/hdfs_tmp_dir", "/tmp")
hadoop_metrics2_properties_content = config['configurations']['hadoop-metrics2.properties']['content']
http://git-wip-us.apache.org/repos/asf/ambari/blob/64f3b39b/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/before-START/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/before-START/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/before-START/scripts/params.py
index d838211..455710b 100644
--- a/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/before-START/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/before-START/scripts/params.py
@@ -45,7 +45,7 @@ stack_root = Script.get_stack_root()
hadoop_conf_dir = "/etc/hadoop/conf"
component_list = default("/localComponents", [])
-hdfs_tmp_dir = config['configurations']['hadoop-env']['hdfs_tmp_dir']
+hdfs_tmp_dir = default("/configurations/hadoop-env/hdfs_tmp_dir", "/tmp")
hadoop_metrics2_properties_content = config['configurations']['hadoop-metrics2.properties']['content']
[12/26] ambari git commit: AMBARI-18814 : Add common log rotation
settings to HDFS configs (Madhuvanthi Radhakrishnan via avijayan).
Posted by nc...@apache.org.
AMBARI-18814 : Add common log rotation settings to HDFS configs (Madhuvanthi Radhakrishnan via avijayan).
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2b91ffda
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2b91ffda
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2b91ffda
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 2b91ffda82194db5aa09f164c490e2d9767dc643
Parents: 02f649f
Author: Aravindan Vijayan <av...@hortonworks.com>
Authored: Tue Dec 20 15:54:58 2016 -0800
Committer: Aravindan Vijayan <av...@hortonworks.com>
Committed: Tue Dec 20 15:54:58 2016 -0800
----------------------------------------------------------------------
.../HDFS/2.1.0.2.0/configuration/hdfs-log4j.xml | 50 ++++++++++++++++++--
.../2.0.6/hooks/before-START/scripts/params.py | 6 +++
.../scripts/shared_initialization.py | 2 +-
.../services/HDFS/configuration/hdfs-log4j.xml | 50 ++++++++++++++++++--
.../hooks/before-START/test_before_start.py | 8 ++--
5 files changed, 103 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/2b91ffda/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hdfs-log4j.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hdfs-log4j.xml b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hdfs-log4j.xml
index 7e9db57..52f166d 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hdfs-log4j.xml
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hdfs-log4j.xml
@@ -20,6 +20,48 @@
*/
-->
<configuration supports_final="false" supports_adding_forbidden="true">
+ <property>
+ <name>hadoop_security_log_max_backup_size</name>
+ <value>256</value>
+ <description>The maximum size of backup file before the log is rotated</description>
+ <display-name>Hadoop Security Log: backup file size</display-name>
+ <value-attributes>
+ <unit>MB</unit>
+ </value-attributes>
+ <on-ambari-upgrade add="false"/>
+ </property>
+ <property>
+ <name>hadoop_security_log_number_of_backup_files</name>
+ <value>20</value>
+ <description>The number of backup files</description>
+ <display-name>Hadoop Security Log: # of backup files</display-name>
+ <value-attributes>
+ <type>int</type>
+ <minimum>0</minimum>
+ </value-attributes>
+ <on-ambari-upgrade add="false"/>
+ </property>
+ <property>
+ <name>hadoop_log_max_backup_size</name>
+ <value>256</value>
+ <description>The maximum size of backup file before the log is rotated</description>
+ <display-name>Hadoop Log: backup file size</display-name>
+ <value-attributes>
+ <unit>MB</unit>
+ </value-attributes>
+ <on-ambari-upgrade add="false"/>
+ </property>
+ <property>
+ <name>hadoop_log_number_of_backup_files</name>
+ <value>20</value>
+ <description>The number of backup files</description>
+ <display-name>Hadoop Log: # of backup files</display-name>
+ <value-attributes>
+ <type>int</type>
+ <minimum>0</minimum>
+ </value-attributes>
+ <on-ambari-upgrade add="false"/>
+ </property>
<property>
<name>content</name>
<display-name>hdfs-log4j template</display-name>
@@ -112,8 +154,8 @@ log4j.appender.TLA.layout.ConversionPattern=%d{ISO8601} %p %c: %m%n
#Security audit appender
#
hadoop.security.logger=INFO,console
-hadoop.security.log.maxfilesize=256MB
-hadoop.security.log.maxbackupindex=20
+hadoop.security.log.maxfilesize={{hadoop_security_log_max_backup_size}}MB
+hadoop.security.log.maxbackupindex={{hadoop_security_log_number_of_backup_files}}
log4j.category.SecurityLogger=${hadoop.security.logger}
hadoop.security.log.file=SecurityAuth.audit
log4j.appender.DRFAS=org.apache.log4j.DailyRollingFileAppender
@@ -161,8 +203,8 @@ log4j.appender.RFA=org.apache.log4j.RollingFileAppender
log4j.appender.RFA.File=${hadoop.log.dir}/${hadoop.log.file}
# Logfile size and and 30-day backups
-log4j.appender.RFA.MaxFileSize=256MB
-log4j.appender.RFA.MaxBackupIndex=10
+log4j.appender.RFA.MaxFileSize={{hadoop_log_max_backup_size}}MB
+log4j.appender.RFA.MaxBackupIndex={{hadoop_log_number_of_backup_files}}
log4j.appender.RFA.layout=org.apache.log4j.PatternLayout
log4j.appender.RFA.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} - %m%n
http://git-wip-us.apache.org/repos/asf/ambari/blob/2b91ffda/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
index b905c2b..2ade512 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
@@ -208,6 +208,12 @@ yarn_log_dir_prefix = default("/configurations/yarn-env/yarn_log_dir_prefix","/v
dfs_hosts = default('/configurations/hdfs-site/dfs.hosts', None)
+# Hdfs log4j settings
+hadoop_log_max_backup_size = default('configurations/hdfs-log4j/hadoop_log_max_backup_size', 256)
+hadoop_log_number_of_backup_files = default('configurations/hdfs-log4j/hadoop_log_number_of_backup_files', 20)
+hadoop_security_log_max_backup_size = default('configurations/hdfs-log4j/hadoop_security_log_max_backup_size', 256)
+hadoop_security_log_number_of_backup_files = default('configurations/hdfs-log4j/hadoop_security_log_number_of_backup_files', 20)
+
# Yarn log4j settings
yarn_rm_summary_log_max_backup_size = default('configurations/yarn-log4j/yarn_rm_summary_log_max_backup_size', 256)
yarn_rm_summary_log_number_of_backup_files = default('configurations/yarn-log4j/yarn_rm_summary_log_number_of_backup_files', 20)
http://git-wip-us.apache.org/repos/asf/ambari/blob/2b91ffda/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/shared_initialization.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/shared_initialization.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/shared_initialization.py
index 5dce8e0..cf958f0 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/shared_initialization.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/shared_initialization.py
@@ -89,7 +89,7 @@ def setup_hadoop():
mode=0644,
group=params.user_group,
owner=params.hdfs_user,
- content=params.log4j_props
+ content=InlineTemplate(params.log4j_props)
)
elif (os.path.exists(format("{params.hadoop_conf_dir}/log4j.properties"))):
File(log4j_filename,
http://git-wip-us.apache.org/repos/asf/ambari/blob/2b91ffda/ambari-server/src/main/resources/stacks/HDP/2.2/services/HDFS/configuration/hdfs-log4j.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HDFS/configuration/hdfs-log4j.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HDFS/configuration/hdfs-log4j.xml
index 4bf4cfe..7bdb938 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HDFS/configuration/hdfs-log4j.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HDFS/configuration/hdfs-log4j.xml
@@ -20,6 +20,48 @@
*/
-->
<configuration supports_final="false" supports_adding_forbidden="true">
+ <property>
+ <name>hadoop_security_log_max_backup_size</name>
+ <value>256</value>
+ <description>The maximum size of backup file before the log is rotated</description>
+ <display-name>Hadoop Security Log: backup file size</display-name>
+ <value-attributes>
+ <unit>MB</unit>
+ </value-attributes>
+ <on-ambari-upgrade add="false"/>
+ </property>
+ <property>
+ <name>hadoop_security_log_number_of_backup_files</name>
+ <value>20</value>
+ <description>The number of backup files</description>
+ <display-name>Hadoop Security Log: # of backup files</display-name>
+ <value-attributes>
+ <type>int</type>
+ <minimum>0</minimum>
+ </value-attributes>
+ <on-ambari-upgrade add="false"/>
+ </property>
+ <property>
+ <name>hadoop_log_max_backup_size</name>
+ <value>256</value>
+ <description>The maximum size of backup file before the log is rotated</description>
+ <display-name>Hadoop Log: backup file size</display-name>
+ <value-attributes>
+ <unit>MB</unit>
+ </value-attributes>
+ <on-ambari-upgrade add="false"/>
+ </property>
+ <property>
+ <name>hadoop_log_number_of_backup_files</name>
+ <value>20</value>
+ <description>The number of backup files</description>
+ <display-name>Hadoop Log: # of backup files</display-name>
+ <value-attributes>
+ <type>int</type>
+ <minimum>0</minimum>
+ </value-attributes>
+ <on-ambari-upgrade add="false"/>
+ </property>
<property>
<name>content</name>
<display-name>hdfs-log4j template</display-name>
@@ -112,8 +154,8 @@ log4j.appender.TLA.layout.ConversionPattern=%d{ISO8601} %p %c: %m%n
#Security audit appender
#
hadoop.security.logger=INFO,console
-hadoop.security.log.maxfilesize=256MB
-hadoop.security.log.maxbackupindex=20
+hadoop.security.log.maxfilesize={{hadoop_security_log_max_backup_size}}MB
+hadoop.security.log.maxbackupindex={{hadoop_security_log_number_of_backup_files}}
log4j.category.SecurityLogger=${hadoop.security.logger}
hadoop.security.log.file=SecurityAuth.audit
log4j.appender.DRFAS=org.apache.log4j.DailyRollingFileAppender
@@ -175,8 +217,8 @@ log4j.appender.RFA=org.apache.log4j.RollingFileAppender
log4j.appender.RFA.File=${hadoop.log.dir}/${hadoop.log.file}
# Logfile size and and 30-day backups
-log4j.appender.RFA.MaxFileSize=256MB
-log4j.appender.RFA.MaxBackupIndex=10
+log4j.appender.RFA.MaxFileSize={{hadoop_log_max_backup_size}}MB
+log4j.appender.RFA.MaxBackupIndex={{hadoop_log_number_of_backup_files}}
log4j.appender.RFA.layout=org.apache.log4j.PatternLayout
log4j.appender.RFA.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} - %m%n
http://git-wip-us.apache.org/repos/asf/ambari/blob/2b91ffda/ambari-server/src/test/python/stacks/2.0.6/hooks/before-START/test_before_start.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/hooks/before-START/test_before_start.py b/ambari-server/src/test/python/stacks/2.0.6/hooks/before-START/test_before_start.py
index 6e5561a..30561ac 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/hooks/before-START/test_before_start.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/hooks/before-START/test_before_start.py
@@ -69,7 +69,7 @@ class TestHookBeforeStart(RMFTestCase):
mode=0644,
group='hadoop',
owner='hdfs',
- content='log4jproperties\nline2log4jproperties\nline2'
+ content=InlineTemplate('log4jproperties\nline2log4jproperties\nline2')
)
self.assertResourceCalled('File', '/etc/hadoop/conf/hadoop-metrics2.properties',
content = InlineTemplate(self.getConfig()['configurations']['hadoop-metrics2.properties']['content']),
@@ -143,7 +143,7 @@ class TestHookBeforeStart(RMFTestCase):
mode=0644,
group='hadoop',
owner='hdfs',
- content='log4jproperties\nline2log4jproperties\nline2'
+ content=InlineTemplate('log4jproperties\nline2log4jproperties\nline2')
)
self.assertResourceCalled('File', '/etc/hadoop/conf/hadoop-metrics2.properties',
content = InlineTemplate(self.getConfig()['configurations']['hadoop-metrics2.properties']['content']),
@@ -222,7 +222,7 @@ class TestHookBeforeStart(RMFTestCase):
mode=0644,
group='hadoop',
owner='hdfs',
- content='log4jproperties\nline2log4jproperties\nline2'
+ content=InlineTemplate('log4jproperties\nline2log4jproperties\nline2')
)
self.assertResourceCalled('File', '/etc/hadoop/conf/hadoop-metrics2.properties',
content = InlineTemplate(self.getConfig()['configurations']['hadoop-metrics2.properties']['content']),
@@ -303,7 +303,7 @@ class TestHookBeforeStart(RMFTestCase):
mode=0644,
group='hadoop',
owner='hdfs',
- content='log4jproperties\nline2log4jproperties\nline2'
+ content=InlineTemplate('log4jproperties\nline2log4jproperties\nline2')
)
self.assertResourceCalled('File', '/etc/hadoop/conf/hadoop-metrics2.properties',
content = InlineTemplate(self.getConfig()['configurations']['hadoop-metrics2.properties']['content']),
[10/26] ambari git commit: AMBARI-19259 - When Updating An Alert
Group a ConcurrentModificationException is Thrown (jonathanhurley)
Posted by nc...@apache.org.
AMBARI-19259 - When Updating An Alert Group a ConcurrentModificationException is Thrown (jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1584984e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1584984e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1584984e
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 1584984e8836f6951794b3ac0309494cc9acb234
Parents: 4fc52a6
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Tue Dec 20 15:17:28 2016 -0500
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Tue Dec 20 16:08:28 2016 -0500
----------------------------------------------------------------------
.../server/orm/entities/AlertGroupEntity.java | 30 +++++++++---
.../server/orm/entities/AlertTargetEntity.java | 28 +++++++----
.../server/orm/dao/AlertDispatchDAOTest.java | 51 ++++++++++++++++++--
3 files changed, 87 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/1584984e/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertGroupEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertGroupEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertGroupEntity.java
index 76c6b62..b660631 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertGroupEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertGroupEntity.java
@@ -19,6 +19,7 @@ package org.apache.ambari.server.orm.entities;
import java.util.Collections;
import java.util.HashSet;
+import java.util.Objects;
import java.util.Set;
import javax.persistence.CascadeType;
@@ -337,19 +338,24 @@ public class AlertGroupEntity {
* the targets, or {@code null} if there are none.
*/
public void setAlertTargets(Set<AlertTargetEntity> alertTargets) {
+ // for any existing associations, remove "this" from those associations
if (null != this.alertTargets) {
- for (AlertTargetEntity target : this.alertTargets) {
+ // make a copy to prevent ConcurrentModificiationExceptions
+ Set<AlertTargetEntity> copyOfAssociatedTargets = new HashSet<>(this.alertTargets);
+ for (AlertTargetEntity target : copyOfAssociatedTargets) {
target.removeAlertGroup(this);
}
}
- this.alertTargets = alertTargets;
-
+ // update all new targets to reflect "this" as an associated group
if (null != alertTargets) {
for (AlertTargetEntity target : alertTargets) {
target.addAlertGroup(this);
}
}
+
+ // update reference
+ this.alertTargets = alertTargets;
}
/**
@@ -367,11 +373,15 @@ public class AlertGroupEntity {
AlertGroupEntity that = (AlertGroupEntity) object;
- if (groupId != null ? !groupId.equals(that.groupId) : that.groupId != null) {
- return false;
+ // use the unique ID if it exists
+ if( null != groupId ){
+ return Objects.equals(groupId, that.groupId);
}
- return true;
+ return Objects.equals(groupId, that.groupId) &&
+ Objects.equals(clusterId, that.clusterId) &&
+ Objects.equals(groupName, that.groupName) &&
+ Objects.equals(serviceName, that.serviceName);
}
/**
@@ -379,8 +389,12 @@ public class AlertGroupEntity {
*/
@Override
public int hashCode() {
- int result = null != groupId ? groupId.hashCode() : 0;
- return result;
+ // use the unique ID if it exists
+ if( null != groupId ){
+ return groupId.hashCode();
+ }
+
+ return Objects.hash(groupId, clusterId, groupName, serviceName);
}
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/1584984e/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertTargetEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertTargetEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertTargetEntity.java
index 9668210..7753b63 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertTargetEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertTargetEntity.java
@@ -22,6 +22,7 @@ import java.util.Collections;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
+import java.util.Objects;
import java.util.Set;
import javax.persistence.Basic;
@@ -384,7 +385,7 @@ public class AlertTargetEntity {
}
/**
- *
+ * {@inheritDoc}
*/
@Override
public boolean equals(Object object) {
@@ -398,21 +399,30 @@ public class AlertTargetEntity {
AlertTargetEntity that = (AlertTargetEntity) object;
- if (targetId != null ? !targetId.equals(that.targetId)
- : that.targetId != null) {
- return false;
+ // use the unique ID if it exists
+ if( null != targetId ){
+ return Objects.equals(targetId, that.targetId);
}
- return true;
- }
+ return Objects.equals(targetId, that.targetId) &&
+ Objects.equals(targetName, that.targetName) &&
+ Objects.equals(notificationType, that.notificationType) &&
+ Objects.equals(isEnabled, that.isEnabled) &&
+ Objects.equals(description, that.description) &&
+ Objects.equals(isGlobal, that.isGlobal);
+ }
/**
- *
+ * {@inheritDoc}
*/
@Override
public int hashCode() {
- int result = null != targetId ? targetId.hashCode() : 0;
- return result;
+ // use the unique ID if it exists
+ if (null != targetId) {
+ return targetId.hashCode();
+ }
+
+ return Objects.hash(targetId, targetName, notificationType, isEnabled, description, isGlobal);
}
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/1584984e/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDispatchDAOTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDispatchDAOTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDispatchDAOTest.java
index 87afb38..ed4a196 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDispatchDAOTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDispatchDAOTest.java
@@ -85,8 +85,6 @@ public class AlertDispatchDAOTest {
private AlertDefinitionDAO m_definitionDao;
private AlertsDAO m_alertsDao;
private OrmTestHelper m_helper;
- private HostComponentDesiredStateDAO hostComponentDesiredStateDAO;
- private HostComponentStateDAO hostComponentStateDAO;
private ServiceFactory m_serviceFactory;
private ServiceComponentFactory m_componentFactory;
@@ -131,7 +129,7 @@ public class AlertDispatchDAOTest {
}
private void initTestData() throws Exception {
- Set<AlertTargetEntity> targets = createTargets();
+ Set<AlertTargetEntity> targets = createTargets(1);
for (int i = 0; i < 2; i++) {
AlertGroupEntity group = new AlertGroupEntity();
@@ -849,9 +847,9 @@ public class AlertDispatchDAOTest {
* @return
* @throws Exception
*/
- private Set<AlertTargetEntity> createTargets() throws Exception {
+ private Set<AlertTargetEntity> createTargets(int numberOfTargets) throws Exception {
Set<AlertTargetEntity> targets = new HashSet<AlertTargetEntity>();
- for (int i = 0; i < 1; i++) {
+ for (int i = 0; i < numberOfTargets; i++) {
AlertTargetEntity target = new AlertTargetEntity();
target.setDescription("Target Description " + i);
target.setNotificationType("EMAIL");
@@ -901,4 +899,47 @@ public class AlertDispatchDAOTest {
assertTrue(group.getAlertDefinitions().contains(definition));
}
}
+
+ /**
+ * Tests that updating JPA associations concurrently doesn't lead to Concu
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testConcurrentGroupModification() throws Exception {
+ createDefinitions();
+
+ AlertGroupEntity group = m_helper.createAlertGroup(m_cluster.getClusterId(), null);
+ final Set<AlertTargetEntity> targets = createTargets(100);
+
+ group.setAlertTargets(targets);
+ group = m_dao.merge(group);
+
+ final class AlertGroupWriterThread extends Thread {
+ private AlertGroupEntity group;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void run() {
+ for (int i = 0; i < 1000; i++) {
+ group.setAlertTargets(new HashSet<>(targets));
+ }
+ }
+ }
+
+ List<Thread> threads = new ArrayList<>();
+ for (int i = 0; i < 5; i++) {
+ AlertGroupWriterThread thread = new AlertGroupWriterThread();
+ threads.add(thread);
+
+ thread.group = group;
+ thread.start();
+ }
+
+ for (Thread thread : threads) {
+ thread.join();
+ }
+ }
}
[06/26] ambari git commit: AMBARI-19195. Add permission for Service
Auto Start (rlevas)
Posted by nc...@apache.org.
AMBARI-19195. Add permission for Service Auto Start (rlevas)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d48b8d9b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d48b8d9b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d48b8d9b
Branch: refs/heads/branch-dev-patch-upgrade
Commit: d48b8d9b0852d22af4f9bb2191c51c706e292460
Parents: c01f4d8
Author: Robert Levas <rl...@hortonworks.com>
Authored: Tue Dec 20 12:55:46 2016 -0500
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Tue Dec 20 12:55:46 2016 -0500
----------------------------------------------------------------------
.../AmbariManagementControllerImpl.java | 279 +++++++++++++++----
.../internal/ComponentResourceProvider.java | 6 +-
.../internal/ConfigurationResourceProvider.java | 12 +-
.../internal/HostResourceProvider.java | 26 +-
.../AmbariAuthorizationFilter.java | 2 +
.../authorization/RoleAuthorization.java | 8 +-
.../server/upgrade/UpgradeCatalog250.java | 54 +++-
.../main/resources/Ambari-DDL-Derby-CREATE.sql | 9 +
.../main/resources/Ambari-DDL-MySQL-CREATE.sql | 9 +
.../main/resources/Ambari-DDL-Oracle-CREATE.sql | 9 +
.../resources/Ambari-DDL-Postgres-CREATE.sql | 9 +
.../resources/Ambari-DDL-SQLAnywhere-CREATE.sql | 9 +
.../resources/Ambari-DDL-SQLServer-CREATE.sql | 9 +
.../security/TestAuthenticationFactory.java | 5 +
.../server/upgrade/UpgradeCatalog250Test.java | 89 ++++++
15 files changed, 426 insertions(+), 109 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d48b8d9b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index 5f64c18..f8191fa 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -783,6 +783,29 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
}
}
+ /**
+ * Creates a configuration.
+ * <p>
+ * This implementation ensures the authenticated user is authorized to create the new configuration
+ * based on the details of what properties are being changed and the authorizations the authenticated
+ * user has been granted.
+ * <p>
+ * Example
+ * <ul>
+ * <li>
+ * If the user is attempting to change a service-level configuration that user must be granted the
+ * <code>SERVICE_MODIFY_CONFIGS</code> privilege (authorization)
+ * </li>
+ * <li>
+ * If the user is attempting to change the cluster-wide value to enable or disable auto-start
+ * (<code>cluster-env/recovery_enabled</code>), that user must be granted the
+ * <code>CLUSTER_MANAGE_AUTO_START</code> privilege (authorization)
+ * </li>
+ * </ul>
+ *
+ * @param request the request object which defines the configuration.
+ * @throws AmbariException when the configuration cannot be created.
+ */
@Override
public synchronized ConfigurationResponse createConfiguration(
ConfigurationRequest request) throws AmbariException, AuthorizationException {
@@ -809,19 +832,32 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
// happen in unit test cases but should not happen with later versions of stacks.
}
+ // Get the changes so that the user's intention can be determined. For example, maybe
+ // the user wants to change the run-as user for a service or maybe the the cluster-wide
+ // recovery mode setting.
+ Map<String, String[]> propertyChanges = getPropertyChanges(cluster, request);
+
if(StringUtils.isEmpty(service)) {
- if (!AuthorizationHelper.isAuthorized(ResourceType.CLUSTER, cluster.getResourceId(),
- EnumSet.of(RoleAuthorization.CLUSTER_MODIFY_CONFIGS))) {
- throw new AuthorizationException("The authenticated user does not have authorization " +
- "to create cluster configurations");
- }
+ // If the configuration is not attached to a specific service, it is a cluster-wide configuration
+ // type. For example, cluster-env.
+
+ // If the user is trying to set the cluster-wide recovery mode, ensure that user
+ // has the appropriate authorization
+ validateAuthorizationToManageServiceAutoStartConfiguration(cluster, configType, propertyChanges);
+
+ // If the user is trying to set any other cluster-wide property, ensure that user
+ // has the appropriate authorization
+ validateAuthorizationToModifyConfigurations(cluster, configType, propertyChanges,
+ Collections.singletonMap("cluster-env", Collections.singleton("recovery_enabled")),
+ false);
}
else {
- if (!AuthorizationHelper.isAuthorized(ResourceType.CLUSTER, cluster.getResourceId(),
- EnumSet.of(RoleAuthorization.SERVICE_MODIFY_CONFIGS))) {
- throw new AuthorizationException("The authenticated user does not have authorization " +
- "to create service configurations");
- }
+ // If the user is trying to set any service-level property, ensure that user
+ // has the appropriate authorization
+ validateAuthorizationToModifyConfigurations(cluster, configType, propertyChanges, null, true);
+
+ // Ensure the user is allowed to update service users and groups.
+ validateAuthorizationToUpdateServiceUsersAndGroups(cluster, configType, propertyChanges);
}
Map<String, String> requestProperties = request.getProperties();
@@ -891,6 +927,11 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
Config config = createConfig(cluster, request.getType(), requestProperties,
request.getVersionTag(), propertiesAttributes);
+ LOG.info(MessageFormat.format("Creating configuration with tag ''{0}'' to cluster ''{1}'' for configuration type {2}",
+ request.getVersionTag(),
+ request.getClusterName(),
+ configType));
+
return new ConfigurationResponse(cluster.getClusterName(), config);
}
@@ -1626,28 +1667,6 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
for (ConfigurationRequest cr : desiredConfigs) {
String configType = cr.getType();
- // If the config type is for a service, then allow a user with SERVICE_MODIFY_CONFIGS to
- // update, else ensure the user has CLUSTER_MODIFY_CONFIGS
- String service = null;
-
- try {
- service = cluster.getServiceForConfigTypes(Collections.singleton(configType));
- } catch (IllegalArgumentException e) {
- // Ignore this since we may have hit a config type that spans multiple services. This may
- // happen in unit test cases but should not happen with later versions of stacks.
- }
-
- if(StringUtils.isEmpty(service)) {
- if (!AuthorizationHelper.isAuthorized(ResourceType.CLUSTER, cluster.getResourceId(), EnumSet.of(RoleAuthorization.CLUSTER_MODIFY_CONFIGS))) {
- throw new AuthorizationException("The authenticated user does not have authorization to modify cluster configurations");
- }
- }
- else {
- if (!AuthorizationHelper.isAuthorized(ResourceType.CLUSTER, cluster.getResourceId(), EnumSet.of(RoleAuthorization.SERVICE_MODIFY_CONFIGS))) {
- throw new AuthorizationException("The authenticated user does not have authorization to modify service configurations");
- }
- }
-
if (null != cr.getProperties()) {
// !!! empty property sets are supported, and need to be able to use
// previously-defined configs (revert)
@@ -1656,16 +1675,13 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
!all.containsKey(cr.getVersionTag()) || // tag not set
cr.getProperties().size() > 0) { // properties to set
- // Ensure the user is allowed to update all properties
- validateAuthorizationToUpdateServiceUsersAndGroups(cluster, cr);
+ cr.setClusterName(cluster.getClusterName());
+ configurationResponses.add(createConfiguration(cr));
LOG.info(MessageFormat.format("Applying configuration with tag ''{0}'' to cluster ''{1}'' for configuration type {2}",
cr.getVersionTag(),
request.getClusterName(),
configType));
-
- cr.setClusterName(cluster.getClusterName());
- configurationResponses.add(createConfiguration(cr));
}
}
note = cr.getServiceConfigVersionNote();
@@ -1842,6 +1858,65 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
}
/**
+ * Given a configuration request, compares the requested properties to the current set of desired
+ * properties for the same configuration type and returns a map of property names to an array of
+ * Strings representing the current value (index 0), and the requested value (index 1).
+ * <p>
+ * <ul>
+ * <li>
+ * If a property is set in the requested property set and not found in the current property set,
+ * the current value (index 0) will be <code>null</code> - {<code>null</code>, "requested value"}
+ * </li>
+ * <li>
+ * If a property is set in the current property set and not found in the requested property set,
+ * the requested value (index 1) will be <code>null</code> - {"current value", <code>null</code>}
+ * </li>
+ * <li>
+ * If a property found in bother current property set and the requested property set,
+ * the requested value (index 1) will be <code>null</code> - {"current value", "requested value"}
+ * </li>
+ * </ul>
+ *
+ * @param cluster the relevant cluster
+ * @param request the request data
+ * @return a map lf property names to String arrays indicating the requsted changes ({current value, requested valiue})
+ */
+ private Map<String, String[]> getPropertyChanges(Cluster cluster, ConfigurationRequest request) {
+ Map<String, String[]> changedProperties = new HashMap<String, String[]>();
+
+ // Ensure that the requested property map is not null.
+ Map<String, String> requestedProperties = request.getProperties();
+ if (requestedProperties == null) {
+ requestedProperties = Collections.emptyMap();
+ }
+
+ // Get the current/desired properties for the relevant configuration type and ensure that the
+ // property map is not null.
+ Config existingConfig = cluster.getDesiredConfigByType(request.getType());
+ Map<String, String> existingProperties = (existingConfig == null) ? null : existingConfig.getProperties();
+ if (existingProperties == null) {
+ existingProperties = Collections.emptyMap();
+ }
+
+ // Ensure all propery names are captured, including missing ones from either set.
+ Set<String> propertyNames = new HashSet<String>();
+ propertyNames.addAll(requestedProperties.keySet());
+ propertyNames.addAll(existingProperties.keySet());
+
+ for(String propertyName:propertyNames) {
+ String requestedValue = requestedProperties.get(propertyName);
+ String existingValue = existingProperties.get(propertyName);
+
+ // Perform case-sensitive match. It is possible that case matters here.
+ if((requestedValue == null) ? (existingValue != null) : !requestedValue.equals(existingValue)) {
+ changedProperties.put(propertyName, new String[]{existingValue, requestedValue});
+ }
+ }
+
+ return changedProperties;
+ }
+
+ /**
* Comparison of two attributes maps
* @param requestConfigAttributes - attribute map sent from API
* @param clusterConfigAttributes - existed attribute map
@@ -5135,22 +5210,24 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
* the properties of types USER and GROUP have not been changed. If they have been, an
* AuthorizationException is thrown.
*
- * @param cluster the relevant cluster
- * @param request the configuration request
+ * @param cluster the relevant cluster
+ * @param configType the changed configuration type
+ * @param propertyChanges a map of the property changes for the relevant configuration type
* @throws AuthorizationException if the user is not authorized to perform this operation
*/
- protected void validateAuthorizationToUpdateServiceUsersAndGroups(Cluster cluster, ConfigurationRequest request)
+ protected void validateAuthorizationToUpdateServiceUsersAndGroups(Cluster cluster,
+ String configType,
+ Map<String, String[]> propertyChanges)
throws AuthorizationException {
- // If the authenticated user is not authorized to set service users or groups, make sure the
- // relevant properties are not changed. However, if the user is authorized to set service
- // users and groups, there is nothing to check.
- if (!AuthorizationHelper.isAuthorized(ResourceType.CLUSTER, cluster.getResourceId(),
- RoleAuthorization.SERVICE_SET_SERVICE_USERS_GROUPS)) {
- Map<String, String> requestProperties = request.getProperties();
- if (requestProperties != null) {
- Map<PropertyInfo.PropertyType, Set<String>> propertyTypes = cluster.getConfigPropertiesTypes(
- request.getType());
+ if ((propertyChanges != null) && !propertyChanges.isEmpty()) {
+ // If the authenticated user is not authorized to set service users or groups, make sure the
+ // relevant properties are not changed. However, if the user is authorized to set service
+ // users and groups, there is nothing to check.
+ if (!AuthorizationHelper.isAuthorized(ResourceType.CLUSTER, cluster.getResourceId(),
+ RoleAuthorization.SERVICE_SET_SERVICE_USERS_GROUPS)) {
+
+ Map<PropertyInfo.PropertyType, Set<String>> propertyTypes = cluster.getConfigPropertiesTypes(configType);
// Create a composite set of properties to check...
Set<String> propertiesToCheck = new HashSet<String>();
@@ -5166,20 +5243,14 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
}
// If there are no USER or GROUP type properties, skip the validation check...
- if (!propertiesToCheck.isEmpty()) {
-
- Config existingConfig = cluster.getDesiredConfigByType(request.getType());
- Map<String, String> existingProperties = (existingConfig == null) ? null : existingConfig.getProperties();
- if (existingProperties == null) {
- existingProperties = Collections.emptyMap();
- }
-
- for (String propertyName : propertiesToCheck) {
- String existingProperty = existingProperties.get(propertyName);
- String requestProperty = requestProperties.get(propertyName);
+ for (String propertyName : propertiesToCheck) {
+ String[] values = propertyChanges.get(propertyName);
+ if (values != null) {
+ String existingValue = values[0];
+ String requestedValue = values[1];
// If the properties don't match, so thrown an authorization exception
- if ((existingProperty == null) ? (requestProperty != null) : !existingProperty.equals(requestProperty)) {
+ if ((existingValue == null) ? (requestedValue != null) : !existingValue.equals(requestedValue)) {
throw new AuthorizationException("The authenticated user is not authorized to set service user and groups");
}
}
@@ -5189,6 +5260,92 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
}
/**
+ * Validates that the authenticated user can manage the cluster-wide configuration for a service's
+ * ability to be set to auto-start.
+ * <p/>
+ * If the user is authorized, than this method exits quickly.
+ * If the user is not authorized, then this method verifies that the configuration property
+ * <code>cluster-env/recovery_enabled</code> is not changed. If it was, an
+ * {@link AuthorizationException} is thrown.
+ *
+ * @param cluster the relevant cluster
+ * @param configType the changed configuration type
+ * @param propertyChanges a map of the property changes for the relevant configuration type
+ * @throws AuthorizationException if the user is not authorized to perform this operation
+ */
+ protected void validateAuthorizationToManageServiceAutoStartConfiguration(Cluster cluster,
+ String configType,
+ Map<String, String[]> propertyChanges)
+ throws AuthorizationException {
+ // If the authenticated user is authorized to manage the cluster-wide configuration for a
+ // service's ability to be set to auto-start, there is nothing to check.
+ if (!AuthorizationHelper.isAuthorized(ResourceType.CLUSTER, cluster.getResourceId(),
+ RoleAuthorization.CLUSTER_MANAGE_AUTO_START)) {
+
+ if ("cluster-env".equals(configType) && propertyChanges.containsKey("recovery_enabled")) {
+ throw new AuthorizationException("The authenticated user is not authorized to set service user and groups");
+ }
+ }
+ }
+
+ /**
+ * Validates that the authenticated user can modify configurations for either a service or the
+ * cluster.
+ * <p>
+ * Since some properties have special meaning, they may be ignored when perfoming this authorization
+ * check. For example, to change the cluster's overall auto-start setting (cluster-env/recovery_enabled)
+ * requires a specific permission that is not the same as the ability to set cluster-wide properties
+ * (in general). Because of this, the <code>cluster-env/recovery_enabled</code> propery should be
+ * ignored in this check since permission to change it is expected to be validated elsewhere.
+ *
+ * @param cluster the relevant cluster
+ * @param configType the changed configuration type
+ * @param propertyChanges a map of the property changes for the relevant configuration type
+ * @param changesToIgnore a map of configuration type names to sets of propery names to be ignored
+ * @param isServiceConfiguration <code>true</code>, if the configuration type is a service-level configuration;
+ * <code>false</code>, if the configuration type is a cluster-level configuration
+ * @throws AuthorizationException if the authenticated user is not authorized to change the requested configuration
+ */
+ private void validateAuthorizationToModifyConfigurations(Cluster cluster, String configType,
+ Map<String, String[]> propertyChanges,
+ Map<String, Set<String>> changesToIgnore,
+ boolean isServiceConfiguration)
+ throws AuthorizationException {
+ // If the authenticated user is authorized to update cluster-wide/service-level configurations
+ // there is nothing to check, else ensure no (relevant) configurations are being changed - ignoring
+ // the specified configurations which may fall under a special category.
+ // For example cluster-env/recovery_enabled requires a special permission - CLUSTER.MANAGE_AUTO_START
+ if ((propertyChanges != null) && !propertyChanges.isEmpty()) {
+ boolean isAuthorized = (isServiceConfiguration)
+ ? AuthorizationHelper.isAuthorized(ResourceType.CLUSTER, cluster.getResourceId(), RoleAuthorization.SERVICE_MODIFY_CONFIGS)
+ : AuthorizationHelper.isAuthorized(ResourceType.CLUSTER, cluster.getResourceId(), RoleAuthorization.CLUSTER_MODIFY_CONFIGS);
+
+ if (!isAuthorized) {
+ Set<String> relevantChangesToIgnore = changesToIgnore.get(configType);
+ Map<String, String[]> relevantPropertyChanges;
+
+ // If necessary remove any non-relevant property changes.
+ if (relevantChangesToIgnore == null)
+ relevantPropertyChanges = propertyChanges;
+ else {
+ relevantPropertyChanges = new HashMap<String, String[]>(propertyChanges);
+
+ for (String propertyName : relevantChangesToIgnore) {
+ relevantPropertyChanges.remove(propertyName);
+ }
+ }
+
+ // If relevant configuration changes have been made, then the user is not authorized to
+ // perform the requested operation and an AuthorizationException must be thrown
+ if (relevantPropertyChanges.size() > 0) {
+ throw new AuthorizationException(String.format("The authenticated user does not have authorization to modify %s configurations",
+ (isServiceConfiguration) ? "service" : "cluster"));
+ }
+ }
+ }
+ }
+
+ /**
* This method will delete a link between an extension version and a stack version (Extension Link).
*
* An extension version is like a stack version but it contains custom services. Linking an extension
http://git-wip-us.apache.org/repos/asf/ambari/blob/d48b8d9b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
index 453c688..65cfcaa 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
@@ -124,7 +124,7 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
setRequiredDeleteAuthorizations(EnumSet.of(RoleAuthorization.SERVICE_ADD_DELETE_SERVICES, RoleAuthorization.HOST_ADD_DELETE_COMPONENTS));
setRequiredGetAuthorizations(RoleAuthorization.AUTHORIZATIONS_VIEW_SERVICE);
setRequiredGetAuthorizations(RoleAuthorization.AUTHORIZATIONS_VIEW_SERVICE);
- setRequiredUpdateAuthorizations(RoleAuthorization.AUTHORIZATIONS_UPDATE_CLUSTER);
+ setRequiredUpdateAuthorizations(RoleAuthorization.AUTHORIZATIONS_UPDATE_SERVICE);
}
@@ -195,7 +195,7 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
}
@Override
- public RequestStatus updateResources(final Request request, Predicate predicate)
+ public RequestStatus updateResourcesAuthorized(final Request request, Predicate predicate)
throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
final Set<ServiceComponentRequest> requests = new HashSet<>();
@@ -552,7 +552,7 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
if (!StringUtils.isEmpty(request.getRecoveryEnabled())) {
// Verify that the authenticated user has authorization to change auto-start states for services
AuthorizationHelper.verifyAuthorization(ResourceType.CLUSTER, getClusterResourceId(clusterName),
- EnumSet.of(RoleAuthorization.SERVICE_START_STOP));
+ EnumSet.of(RoleAuthorization.CLUSTER_MANAGE_AUTO_START, RoleAuthorization.SERVICE_MANAGE_AUTO_START));
boolean newRecoveryEnabled = Boolean.parseBoolean(request.getRecoveryEnabled());
boolean oldRecoveryEnabled = sc.isRecoveryEnabled();
http://git-wip-us.apache.org/repos/asf/ambari/blob/d48b8d9b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProvider.java
index 6e9765c..7c8e49e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProvider.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -103,13 +103,11 @@ public class ConfigurationResourceProvider extends
* @param managementController the associated management controller
*/
ConfigurationResourceProvider(AmbariManagementController managementController) {
-
super(PROPERTY_IDS, KEY_PROPERTY_IDS, managementController);
- EnumSet<RoleAuthorization> createConfigsAuthSet =
- EnumSet.of(RoleAuthorization.SERVICE_MODIFY_CONFIGS, RoleAuthorization.CLUSTER_MODIFY_CONFIGS);
- setRequiredCreateAuthorizations(createConfigsAuthSet);
- //update and delete are not supported for configs
+ // creating configs requires authorizations based on the type of changes being performed, therefore
+ // checks need to be performed inline.
+ // update and delete are not supported for configs
setRequiredGetAuthorizations(EnumSet.of(RoleAuthorization.CLUSTER_VIEW_CONFIGS));
}
@@ -118,7 +116,7 @@ public class ConfigurationResourceProvider extends
// ----- ResourceProvider --------------------------------------------------
@Override
- public RequestStatus createResourcesAuthorized(Request request)
+ public RequestStatus createResources(Request request)
throws SystemException,
UnsupportedPropertyException,
ResourceAlreadyExistsException,
http://git-wip-us.apache.org/repos/asf/ambari/blob/d48b8d9b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
index 05d635a..8142afc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -773,30 +773,6 @@ public class HostResourceProvider extends AbstractControllerResourceProvider {
if (clusters.getHostsForCluster(clusterName).containsKey(host.getHostName())) {
for (ConfigurationRequest cr : request.getDesiredConfigs()) {
- String configType = cr.getType();
-
- // If the config type is for a service, then allow a user with SERVICE_MODIFY_CONFIGS to
- // update, else ensure the user has CLUSTER_MODIFY_CONFIGS
- String service = null;
-
- try {
- service = cluster.getServiceForConfigTypes(Collections.singleton(configType));
- } catch (IllegalArgumentException e) {
- // Ignore this since we may have hit a config type that spans multiple services. This may
- // happen in unit test cases but should not happen with later versions of stacks.
- }
-
- if(StringUtils.isEmpty(service)) {
- if (!AuthorizationHelper.isAuthorized(ResourceType.CLUSTER, cluster.getResourceId(), EnumSet.of(RoleAuthorization.CLUSTER_MODIFY_CONFIGS))) {
- throw new AuthorizationException("The authenticated user does not have authorization to modify cluster configurations");
- }
- }
- else {
- if (!AuthorizationHelper.isAuthorized(ResourceType.CLUSTER, cluster.getResourceId(), EnumSet.of(RoleAuthorization.SERVICE_MODIFY_CONFIGS))) {
- throw new AuthorizationException("The authenticated user does not have authorization to modify service configurations");
- }
- }
-
if (null != cr.getProperties() && cr.getProperties().size() > 0) {
LOG.info(MessageFormat.format("Applying configuration with tag ''{0}'' to host ''{1}'' in cluster ''{2}''",
cr.getVersionTag(),
http://git-wip-us.apache.org/repos/asf/ambari/blob/d48b8d9b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariAuthorizationFilter.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariAuthorizationFilter.java b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariAuthorizationFilter.java
index c7362aa..1faadb6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariAuthorizationFilter.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariAuthorizationFilter.java
@@ -81,6 +81,7 @@ public class AmbariAuthorizationFilter implements Filter {
private static final String API_CLUSTER_ALERT_ALL_PATTERN = API_VERSION_PREFIX + "/clusters/.*?/alert.*";
private static final String API_CLUSTER_HOSTS_ALL_PATTERN = API_VERSION_PREFIX + "/clusters/.*?/hosts.*";
private static final String API_CLUSTER_CONFIGURATIONS_ALL_PATTERN = API_VERSION_PREFIX + "/clusters/.*?/configurations.*";
+ private static final String API_CLUSTER_COMPONENTS_ALL_PATTERN = API_VERSION_PREFIX + "/clusters/.*?/components.*";
private static final String API_CLUSTER_HOST_COMPONENTS_ALL_PATTERN = API_VERSION_PREFIX + "/clusters/.*?/host_components.*";
private static final String API_CLUSTER_CONFIG_GROUPS_ALL_PATTERN = API_VERSION_PREFIX + "/clusters/.*?/config_groups.*";
private static final String API_STACK_VERSIONS_PATTERN = API_VERSION_PREFIX + "/stacks/.*?/versions/.*";
@@ -341,6 +342,7 @@ public class AmbariAuthorizationFilter implements Filter {
requestURI.matches(API_WIDGET_LAYOUTS_PATTERN) ||
requestURI.matches(API_CLUSTER_HOSTS_ALL_PATTERN) ||
requestURI.matches(API_CLUSTER_CONFIGURATIONS_ALL_PATTERN) ||
+ requestURI.matches(API_CLUSTER_COMPONENTS_ALL_PATTERN) ||
requestURI.matches(API_CLUSTER_HOST_COMPONENTS_ALL_PATTERN) ||
requestURI.matches(API_CLUSTER_CONFIG_GROUPS_ALL_PATTERN) ||
requestURI.matches(API_HOSTS_ALL_PATTERN) ||
http://git-wip-us.apache.org/repos/asf/ambari/blob/d48b8d9b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/RoleAuthorization.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/RoleAuthorization.java b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/RoleAuthorization.java
index 4a0ea71..969772f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/RoleAuthorization.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/RoleAuthorization.java
@@ -53,6 +53,7 @@ public enum RoleAuthorization {
CLUSTER_VIEW_STACK_DETAILS("CLUSTER.VIEW_STACK_DETAILS"),
CLUSTER_VIEW_STATUS_INFO("CLUSTER.VIEW_STATUS_INFO"),
CLUSTER_RUN_CUSTOM_COMMAND("CLUSTER.RUN_CUSTOM_COMMAND"),
+ CLUSTER_MANAGE_AUTO_START("CLUSTER.MANAGE_AUTO_START"),
HOST_ADD_DELETE_COMPONENTS("HOST.ADD_DELETE_COMPONENTS"),
HOST_ADD_DELETE_HOSTS("HOST.ADD_DELETE_HOSTS"),
HOST_TOGGLE_MAINTENANCE("HOST.TOGGLE_MAINTENANCE"),
@@ -78,6 +79,7 @@ public enum RoleAuthorization {
SERVICE_VIEW_CONFIGS("SERVICE.VIEW_CONFIGS"),
SERVICE_VIEW_METRICS("SERVICE.VIEW_METRICS"),
SERVICE_VIEW_STATUS_INFO("SERVICE.VIEW_STATUS_INFO"),
+ SERVICE_MANAGE_AUTO_START("SERVICE.MANAGE_AUTO_START"),
VIEW_USE("VIEW.USE");
public static final Set<RoleAuthorization> AUTHORIZATIONS_VIEW_CLUSTER = EnumSet.of(
@@ -97,6 +99,7 @@ public enum RoleAuthorization {
CLUSTER_TOGGLE_KERBEROS,
CLUSTER_UPGRADE_DOWNGRADE_STACK,
CLUSTER_MODIFY_CONFIGS,
+ CLUSTER_MANAGE_AUTO_START,
SERVICE_MODIFY_CONFIGS);
public static final Set<RoleAuthorization> AUTHORIZATIONS_VIEW_SERVICE = EnumSet.of(
@@ -128,7 +131,10 @@ public enum RoleAuthorization {
SERVICE_TOGGLE_ALERTS,
SERVICE_MOVE,
SERVICE_RUN_CUSTOM_COMMAND,
- SERVICE_RUN_SERVICE_CHECK);
+ SERVICE_RUN_SERVICE_CHECK,
+ SERVICE_MANAGE_ALERTS,
+ SERVICE_MANAGE_AUTO_START,
+ SERVICE_SET_SERVICE_USERS_GROUPS);
private final String id;
http://git-wip-us.apache.org/repos/asf/ambari/blob/d48b8d9b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
index a7e73fe..9734212 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
@@ -17,16 +17,8 @@
*/
package org.apache.ambari.server.upgrade;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicLong;
+import com.google.inject.Inject;
+import com.google.inject.Injector;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.actionmanager.CommandExecutionType;
@@ -43,8 +35,18 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.support.JdbcUtils;
-import com.google.inject.Inject;
-import com.google.inject.Injector;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicLong;
/**
* Upgrade catalog for version 2.5.0.
@@ -150,6 +152,7 @@ public class UpgradeCatalog250 extends AbstractUpgradeCatalog {
updateHiveLlapConfigs();
updateTablesForZeppelinViewRemoval();
updateAtlasConfigs();
+ addManageServiceAutoStartPermissions();
}
protected void updateHostVersionTable() throws SQLException {
@@ -515,4 +518,31 @@ public class UpgradeCatalog250 extends AbstractUpgradeCatalog {
}
}
}
+
+ /**
+ * Add permissions for managing service auto-start.
+ * <p>
+ * <ul>
+ * <li>SERVICE.MANAGE_AUTO_START permissions for SERVICE.ADMINISTRATOR, CLUSTER.OPERATOR, CLUSTER.ADMINISTRATOR, AMBARI.ADMINISTRATOR</li>
+ * <li>CLUSTER.MANAGE_AUTO_START permissions for CLUSTER.OPERATOR, CLUSTER.ADMINISTRATOR, AMBARI.ADMINISTRATOR</li>
+ * </ul>
+ */
+ protected void addManageServiceAutoStartPermissions() throws SQLException {
+ Collection<String> roles;
+
+ // Add service-level auto-start permission
+ roles = Arrays.asList(
+ "AMBARI.ADMINISTRATOR:AMBARI",
+ "CLUSTER.ADMINISTRATOR:CLUSTER",
+ "CLUSTER.OPERATOR:CLUSTER",
+ "SERVICE.ADMINISTRATOR:CLUSTER");
+ addRoleAuthorization("SERVICE.MANAGE_AUTO_START", "Manage service auto-start", roles);
+
+ // Add cluster-level auto start-permission
+ roles = Arrays.asList(
+ "AMBARI.ADMINISTRATOR:AMBARI",
+ "CLUSTER.ADMINISTRATOR:CLUSTER",
+ "CLUSTER.OPERATOR:CLUSTER");
+ addRoleAuthorization("CLUSTER.MANAGE_AUTO_START", "Manage service auto-start configuration", roles);
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d48b8d9b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
index 6d79cd4..b79c945 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
@@ -1238,6 +1238,7 @@ INSERT INTO roleauthorization(authorization_id, authorization_name)
SELECT 'SERVICE.ADD_DELETE_SERVICES', 'Add/Delete services' FROM SYSIBM.SYSDUMMY1 UNION ALL
SELECT 'SERVICE.VIEW_OPERATIONAL_LOGS', 'View service operational logs' FROM SYSIBM.SYSDUMMY1 UNION ALL
SELECT 'SERVICE.SET_SERVICE_USERS_GROUPS', 'Set service users and groups' FROM SYSIBM.SYSDUMMY1 UNION ALL
+ SELECT 'SERVICE.MANAGE_AUTO_START', 'Manage service auto-start' FROM SYSIBM.SYSDUMMY1 UNION ALL
SELECT 'HOST.VIEW_METRICS', 'View metrics' FROM SYSIBM.SYSDUMMY1 UNION ALL
SELECT 'HOST.VIEW_STATUS_INFO', 'View status information' FROM SYSIBM.SYSDUMMY1 UNION ALL
SELECT 'HOST.VIEW_CONFIGS', 'View configuration' FROM SYSIBM.SYSDUMMY1 UNION ALL
@@ -1257,6 +1258,7 @@ INSERT INTO roleauthorization(authorization_id, authorization_name)
SELECT 'CLUSTER.UPGRADE_DOWNGRADE_STACK', 'Upgrade/downgrade stack' FROM SYSIBM.SYSDUMMY1 UNION ALL
SELECT 'CLUSTER.MANAGE_USER_PERSISTED_DATA', 'Manage cluster-level user persisted data' FROM SYSIBM.SYSDUMMY1 UNION ALL
SELECT 'CLUSTER.RUN_CUSTOM_COMMAND', 'Perform custom cluster-level actions' FROM SYSIBM.SYSDUMMY1 UNION ALL
+ SELECT 'CLUSTER.MANAGE_AUTO_START', 'Manage service auto-start configuration' FROM SYSIBM.SYSDUMMY1 UNION ALL
SELECT 'AMBARI.ADD_DELETE_CLUSTERS', 'Create new clusters' FROM SYSIBM.SYSDUMMY1 UNION ALL
SELECT 'AMBARI.RENAME_CLUSTER', 'Rename clusters' FROM SYSIBM.SYSDUMMY1 UNION ALL
SELECT 'AMBARI.MANAGE_SETTINGS', 'Manage settings' FROM SYSIBM.SYSDUMMY1 UNION ALL
@@ -1326,6 +1328,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'SERVICE.MODIFY_CONFIGS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.MANAGE_CONFIG_GROUPS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.VIEW_OPERATIONAL_LOGS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'SERVICE.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_METRICS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_STATUS_INFO' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_CONFIGS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
@@ -1354,6 +1357,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'SERVICE.MOVE' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'SERVICE.ENABLE_HA' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'SERVICE.VIEW_OPERATIONAL_LOGS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
+ SELECT permission_id, 'SERVICE.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_METRICS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_STATUS_INFO' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_CONFIGS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
@@ -1367,6 +1371,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'CLUSTER.MANAGE_CONFIG_GROUPS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'CLUSTER.VIEW_ALERTS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'CLUSTER.MANAGE_CREDENTIALS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
+ SELECT permission_id, 'CLUSTER.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'CLUSTER.MANAGE_USER_PERSISTED_DATA' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR';
-- Set authorizations for Cluster Administrator role
@@ -1389,6 +1394,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'SERVICE.ADD_DELETE_SERVICES' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.VIEW_OPERATIONAL_LOGS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.SET_SERVICE_USERS_GROUPS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'SERVICE.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_METRICS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_STATUS_INFO' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_CONFIGS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
@@ -1407,6 +1413,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'CLUSTER.TOGGLE_KERBEROS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.UPGRADE_DOWNGRADE_STACK' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.MANAGE_USER_PERSISTED_DATA' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'CLUSTER.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.RUN_CUSTOM_COMMAND' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR';
-- Set authorizations for Administrator role
@@ -1430,6 +1437,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'SERVICE.ADD_DELETE_SERVICES' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.VIEW_OPERATIONAL_LOGS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.SET_SERVICE_USERS_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'SERVICE.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_METRICS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_STATUS_INFO' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_CONFIGS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
@@ -1448,6 +1456,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'CLUSTER.TOGGLE_KERBEROS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.UPGRADE_DOWNGRADE_STACK' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.RUN_CUSTOM_COMMAND' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'CLUSTER.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.MANAGE_USER_PERSISTED_DATA' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'AMBARI.ADD_DELETE_CLUSTERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'AMBARI.RENAME_CLUSTER' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
http://git-wip-us.apache.org/repos/asf/ambari/blob/d48b8d9b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
index b493d0a..1c502bc 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -1185,6 +1185,7 @@ INSERT INTO roleauthorization(authorization_id, authorization_name)
SELECT 'SERVICE.ADD_DELETE_SERVICES', 'Add/delete services' UNION ALL
SELECT 'SERVICE.VIEW_OPERATIONAL_LOGS', 'View service operational logs' UNION ALL
SELECT 'SERVICE.SET_SERVICE_USERS_GROUPS', 'Set service users and groups' UNION ALL
+ SELECT 'SERVICE.MANAGE_AUTO_START', 'Manage service auto-start' UNION ALL
SELECT 'HOST.VIEW_METRICS', 'View metrics' UNION ALL
SELECT 'HOST.VIEW_STATUS_INFO', 'View status information' UNION ALL
SELECT 'HOST.VIEW_CONFIGS', 'View configuration' UNION ALL
@@ -1205,6 +1206,7 @@ INSERT INTO roleauthorization(authorization_id, authorization_name)
SELECT 'CLUSTER.TOGGLE_KERBEROS', 'Enable/disable Kerberos' UNION ALL
SELECT 'CLUSTER.UPGRADE_DOWNGRADE_STACK', 'Upgrade/downgrade stack' UNION ALL
SELECT 'CLUSTER.RUN_CUSTOM_COMMAND', 'Perform custom cluster-level actions' UNION ALL
+ SELECT 'CLUSTER.MANAGE_AUTO_START', 'Manage service auto-start configuration' UNION ALL
SELECT 'AMBARI.ADD_DELETE_CLUSTERS', 'Create new clusters' UNION ALL
SELECT 'AMBARI.RENAME_CLUSTER', 'Rename clusters' UNION ALL
SELECT 'AMBARI.MANAGE_SETTINGS', 'Manage administrative settings' UNION ALL
@@ -1274,6 +1276,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'SERVICE.MODIFY_CONFIGS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.MANAGE_CONFIG_GROUPS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.VIEW_OPERATIONAL_LOGS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'SERVICE.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_METRICS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_STATUS_INFO' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_CONFIGS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
@@ -1302,6 +1305,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'SERVICE.MOVE' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'SERVICE.ENABLE_HA' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'SERVICE.VIEW_OPERATIONAL_LOGS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
+ SELECT permission_id, 'SERVICE.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_METRICS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_STATUS_INFO' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_CONFIGS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
@@ -1315,6 +1319,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'CLUSTER.MANAGE_CONFIG_GROUPS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'CLUSTER.VIEW_ALERTS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'CLUSTER.MANAGE_CREDENTIALS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
+ SELECT permission_id, 'CLUSTER.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'CLUSTER.MANAGE_USER_PERSISTED_DATA' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR';
-- Set authorizations for Cluster Administrator role
@@ -1338,6 +1343,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'SERVICE.ADD_DELETE_SERVICES' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.VIEW_OPERATIONAL_LOGS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.SET_SERVICE_USERS_GROUPS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'SERVICE.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_METRICS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_STATUS_INFO' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_CONFIGS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
@@ -1357,6 +1363,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'CLUSTER.TOGGLE_KERBEROS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.UPGRADE_DOWNGRADE_STACK' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.MANAGE_USER_PERSISTED_DATA' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'CLUSTER.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.RUN_CUSTOM_COMMAND' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR';
-- Set authorizations for Administrator role
@@ -1381,6 +1388,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'SERVICE.ADD_DELETE_SERVICES' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.VIEW_OPERATIONAL_LOGS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.SET_SERVICE_USERS_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'SERVICE.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_METRICS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_STATUS_INFO' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_CONFIGS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
@@ -1400,6 +1408,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'CLUSTER.TOGGLE_KERBEROS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.UPGRADE_DOWNGRADE_STACK' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.MANAGE_USER_PERSISTED_DATA' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'CLUSTER.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.RUN_CUSTOM_COMMAND' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'AMBARI.ADD_DELETE_CLUSTERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'AMBARI.RENAME_CLUSTER' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
http://git-wip-us.apache.org/repos/asf/ambari/blob/d48b8d9b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
index 3e40103..c6d4ad0 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -1183,6 +1183,7 @@ INSERT INTO roleauthorization(authorization_id, authorization_name)
SELECT 'SERVICE.ADD_DELETE_SERVICES', 'Add/delete services' FROM dual UNION ALL
SELECT 'SERVICE.VIEW_OPERATIONAL_LOGS', 'View service operational logs' from dual UNION ALL
SELECT 'SERVICE.SET_SERVICE_USERS_GROUPS', 'Set service users and groups' FROM dual UNION ALL
+ SELECT 'SERVICE.MANAGE_AUTO_START', 'Manage service auto-start' FROM dual UNION ALL
SELECT 'HOST.VIEW_METRICS', 'View metrics' FROM dual UNION ALL
SELECT 'HOST.VIEW_STATUS_INFO', 'View status information' FROM dual UNION ALL
SELECT 'HOST.VIEW_CONFIGS', 'View configuration' FROM dual UNION ALL
@@ -1203,6 +1204,7 @@ INSERT INTO roleauthorization(authorization_id, authorization_name)
SELECT 'CLUSTER.TOGGLE_KERBEROS', 'Enable/disable Kerberos' FROM dual UNION ALL
SELECT 'CLUSTER.UPGRADE_DOWNGRADE_STACK', 'Upgrade/downgrade stack' FROM dual UNION ALL
SELECT 'CLUSTER.RUN_CUSTOM_COMMAND', 'Perform custom cluster-level actions' FROM dual UNION ALL
+ SELECT 'CLUSTER.MANAGE_AUTO_START', 'Manage service auto-start configuration' FROM dual UNION ALL
SELECT 'AMBARI.ADD_DELETE_CLUSTERS', 'Create new clusters' FROM dual UNION ALL
SELECT 'AMBARI.RENAME_CLUSTER', 'Rename clusters' FROM dual UNION ALL
SELECT 'AMBARI.MANAGE_SETTINGS', 'Manage settings' FROM dual UNION ALL
@@ -1272,6 +1274,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'SERVICE.MODIFY_CONFIGS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.MANAGE_CONFIG_GROUPS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.VIEW_OPERATIONAL_LOGS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'SERVICE.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_METRICS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_STATUS_INFO' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_CONFIGS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
@@ -1300,6 +1303,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'SERVICE.MOVE' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'SERVICE.ENABLE_HA' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'SERVICE.VIEW_OPERATIONAL_LOGS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
+ SELECT permission_id, 'SERVICE.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_METRICS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_STATUS_INFO' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_CONFIGS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
@@ -1313,6 +1317,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'CLUSTER.MANAGE_CONFIG_GROUPS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'CLUSTER.VIEW_ALERTS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'CLUSTER.MANAGE_CREDENTIALS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
+ SELECT permission_id, 'CLUSTER.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'CLUSTER.MANAGE_USER_PERSISTED_DATA' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR';
-- Set authorizations for Cluster Administrator role
@@ -1336,6 +1341,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'SERVICE.ADD_DELETE_SERVICES' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.VIEW_OPERATIONAL_LOGS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.SET_SERVICE_USERS_GROUPS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'SERVICE.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_METRICS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_STATUS_INFO' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_CONFIGS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
@@ -1355,6 +1361,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'CLUSTER.TOGGLE_KERBEROS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.UPGRADE_DOWNGRADE_STACK' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.MANAGE_USER_PERSISTED_DATA' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'CLUSTER.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.RUN_CUSTOM_COMMAND' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR';
-- Set authorizations for Administrator role
@@ -1379,6 +1386,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'SERVICE.ADD_DELETE_SERVICES' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.VIEW_OPERATIONAL_LOGS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.SET_SERVICE_USERS_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'SERVICE.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_METRICS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_STATUS_INFO' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_CONFIGS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
@@ -1398,6 +1406,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'CLUSTER.TOGGLE_KERBEROS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.UPGRADE_DOWNGRADE_STACK' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.MANAGE_USER_PERSISTED_DATA' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'CLUSTER.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.RUN_CUSTOM_COMMAND' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'AMBARI.ADD_DELETE_CLUSTERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'AMBARI.RENAME_CLUSTER' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
http://git-wip-us.apache.org/repos/asf/ambari/blob/d48b8d9b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
index e072805..1be87bb 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -1165,6 +1165,7 @@ INSERT INTO roleauthorization(authorization_id, authorization_name)
SELECT 'SERVICE.ADD_DELETE_SERVICES', 'Add/delete services' UNION ALL
SELECT 'SERVICE.VIEW_OPERATIONAL_LOGS', 'View service operational logs' UNION ALL
SELECT 'SERVICE.SET_SERVICE_USERS_GROUPS', 'Set service users and groups' UNION ALL
+ SELECT 'SERVICE.MANAGE_AUTO_START', 'Manage service auto-start' UNION ALL
SELECT 'HOST.VIEW_METRICS', 'View metrics' UNION ALL
SELECT 'HOST.VIEW_STATUS_INFO', 'View status information' UNION ALL
SELECT 'HOST.VIEW_CONFIGS', 'View configuration' UNION ALL
@@ -1185,6 +1186,7 @@ INSERT INTO roleauthorization(authorization_id, authorization_name)
SELECT 'CLUSTER.TOGGLE_KERBEROS', 'Enable/disable Kerberos' UNION ALL
SELECT 'CLUSTER.UPGRADE_DOWNGRADE_STACK', 'Upgrade/downgrade stack' UNION ALL
SELECT 'CLUSTER.RUN_CUSTOM_COMMAND', 'Perform custom cluster-level actions' UNION ALL
+ SELECT 'CLUSTER.MANAGE_AUTO_START', 'Manage service auto-start configuration' UNION ALL
SELECT 'AMBARI.ADD_DELETE_CLUSTERS', 'Create new clusters' UNION ALL
SELECT 'AMBARI.RENAME_CLUSTER', 'Rename clusters' UNION ALL
SELECT 'AMBARI.MANAGE_SETTINGS', 'Manage administrative settings' UNION ALL
@@ -1254,6 +1256,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'SERVICE.MODIFY_CONFIGS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.MANAGE_CONFIG_GROUPS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.VIEW_OPERATIONAL_LOGS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'SERVICE.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_METRICS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_STATUS_INFO' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_CONFIGS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
@@ -1282,6 +1285,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'SERVICE.MOVE' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'SERVICE.ENABLE_HA' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'SERVICE.VIEW_OPERATIONAL_LOGS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
+ SELECT permission_id, 'SERVICE.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_METRICS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_STATUS_INFO' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_CONFIGS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
@@ -1295,6 +1299,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'CLUSTER.MANAGE_CONFIG_GROUPS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'CLUSTER.VIEW_ALERTS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'CLUSTER.MANAGE_CREDENTIALS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
+ SELECT permission_id, 'CLUSTER.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'CLUSTER.MANAGE_USER_PERSISTED_DATA' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR';
-- Set authorizations for Cluster Administrator role
@@ -1318,6 +1323,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'SERVICE.ADD_DELETE_SERVICES' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.VIEW_OPERATIONAL_LOGS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.SET_SERVICE_USERS_GROUPS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'SERVICE.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_METRICS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_STATUS_INFO' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_CONFIGS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
@@ -1337,6 +1343,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'CLUSTER.TOGGLE_KERBEROS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.UPGRADE_DOWNGRADE_STACK' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.MANAGE_USER_PERSISTED_DATA' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'CLUSTER.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.RUN_CUSTOM_COMMAND' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR';
-- Set authorizations for Administrator role
@@ -1361,6 +1368,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'SERVICE.ADD_DELETE_SERVICES' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.VIEW_OPERATIONAL_LOGS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.SET_SERVICE_USERS_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'SERVICE.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_METRICS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_STATUS_INFO' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_CONFIGS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
@@ -1380,6 +1388,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
SELECT permission_id, 'CLUSTER.TOGGLE_KERBEROS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.UPGRADE_DOWNGRADE_STACK' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.MANAGE_USER_PERSISTED_DATA' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'CLUSTER.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.RUN_CUSTOM_COMMAND' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'AMBARI.ADD_DELETE_CLUSTERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'AMBARI.RENAME_CLUSTER' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
http://git-wip-us.apache.org/repos/asf/ambari/blob/d48b8d9b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
index 01d9be5..abe48e8 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
@@ -1180,6 +1180,7 @@ insert into adminpermission(permission_id, permission_name, resource_type_id, pe
SELECT 'SERVICE.ADD_DELETE_SERVICES', 'Add/delete services' UNION ALL
SELECT 'SERVICE.VIEW_OPERATIONAL_LOGS', 'View service operational logs' UNION ALL
SELECT 'SERVICE.SET_SERVICE_USERS_GROUPS', 'Set service users and groups' UNION ALL
+ SELECT 'SERVICE.MANAGE_AUTO_START', 'Manage service auto-start' UNION ALL
SELECT 'HOST.VIEW_METRICS', 'View metrics' UNION ALL
SELECT 'HOST.VIEW_STATUS_INFO', 'View status information' UNION ALL
SELECT 'HOST.VIEW_CONFIGS', 'View configuration' UNION ALL
@@ -1200,6 +1201,7 @@ insert into adminpermission(permission_id, permission_name, resource_type_id, pe
SELECT 'CLUSTER.TOGGLE_KERBEROS', 'Enable/disable Kerberos' UNION ALL
SELECT 'CLUSTER.UPGRADE_DOWNGRADE_STACK', 'Upgrade/downgrade stack' UNION ALL
SELECT 'CLUSTER.RUN_CUSTOM_COMMAND', 'Perform custom cluster-level actions' UNION ALL
+ SELECT 'CLUSTER.MANAGE_AUTO_START', 'Manage service auto-start configuration' UNION ALL
SELECT 'AMBARI.ADD_DELETE_CLUSTERS', 'Create new clusters' UNION ALL
SELECT 'AMBARI.RENAME_CLUSTER', 'Rename clusters' UNION ALL
SELECT 'AMBARI.MANAGE_SETTINGS', 'Manage settings' UNION ALL
@@ -1269,6 +1271,7 @@ insert into adminpermission(permission_id, permission_name, resource_type_id, pe
SELECT permission_id, 'SERVICE.MODIFY_CONFIGS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.MANAGE_CONFIG_GROUPS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.VIEW_OPERATIONAL_LOGS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'SERVICE.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_METRICS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_STATUS_INFO' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_CONFIGS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
@@ -1297,6 +1300,7 @@ insert into adminpermission(permission_id, permission_name, resource_type_id, pe
SELECT permission_id, 'SERVICE.MOVE' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'SERVICE.ENABLE_HA' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'SERVICE.VIEW_OPERATIONAL_LOGS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
+ SELECT permission_id, 'SERVICE.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_METRICS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_STATUS_INFO' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_CONFIGS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
@@ -1310,6 +1314,7 @@ insert into adminpermission(permission_id, permission_name, resource_type_id, pe
SELECT permission_id, 'CLUSTER.MANAGE_CONFIG_GROUPS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'CLUSTER.VIEW_ALERTS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'CLUSTER.MANAGE_CREDENTIALS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
+ SELECT permission_id, 'CLUSTER.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'CLUSTER.MANAGE_USER_PERSISTED_DATA' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR';
-- Set authorizations for Cluster Administrator role
@@ -1333,6 +1338,7 @@ insert into adminpermission(permission_id, permission_name, resource_type_id, pe
SELECT permission_id, 'SERVICE.ADD_DELETE_SERVICES' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.VIEW_OPERATIONAL_LOGS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.SET_SERVICE_USERS_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'SERVICE.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_METRICS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_STATUS_INFO' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_CONFIGS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
@@ -1352,6 +1358,7 @@ insert into adminpermission(permission_id, permission_name, resource_type_id, pe
SELECT permission_id, 'CLUSTER.TOGGLE_KERBEROS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.UPGRADE_DOWNGRADE_STACK' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.MANAGE_USER_PERSISTED_DATA' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'CLUSTER.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.RUN_CUSTOM_COMMAND' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR';
-- Set authorizations for Administrator role
@@ -1376,6 +1383,7 @@ insert into adminpermission(permission_id, permission_name, resource_type_id, pe
SELECT permission_id, 'SERVICE.ADD_DELETE_SERVICES' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.VIEW_OPERATIONAL_LOGS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.SET_SERVICE_USERS_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'SERVICE.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_METRICS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_STATUS_INFO' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_CONFIGS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
@@ -1395,6 +1403,7 @@ insert into adminpermission(permission_id, permission_name, resource_type_id, pe
SELECT permission_id, 'CLUSTER.TOGGLE_KERBEROS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.UPGRADE_DOWNGRADE_STACK' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.MANAGE_USER_PERSISTED_DATA' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'CLUSTER.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.RUN_SERVICE_CHECK' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'AMBARI.ADD_DELETE_CLUSTERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'AMBARI.RENAME_CLUSTER' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
http://git-wip-us.apache.org/repos/asf/ambari/blob/d48b8d9b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
index dc03827..169a464 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
@@ -1194,6 +1194,7 @@ BEGIN TRANSACTION
SELECT 'SERVICE.ADD_DELETE_SERVICES', 'Add/delete services' UNION ALL
SELECT 'SERVICE.VIEW_OPERATIONAL_LOGS', 'View service operational logs' UNION ALL
SELECT 'SERVICE.SET_SERVICE_USERS_GROUPS', 'Set service users and groups' UNION ALL
+ SELECT 'SERVICE.MANAGE_AUTO_START', 'Manage service auto-start' UNION ALL
SELECT 'HOST.VIEW_METRICS', 'View metrics' UNION ALL
SELECT 'HOST.VIEW_STATUS_INFO', 'View status information' UNION ALL
SELECT 'HOST.VIEW_CONFIGS', 'View configuration' UNION ALL
@@ -1214,6 +1215,7 @@ BEGIN TRANSACTION
SELECT 'CLUSTER.TOGGLE_KERBEROS', 'Enable/disable Kerberos' UNION ALL
SELECT 'CLUSTER.UPGRADE_DOWNGRADE_STACK', 'Upgrade/downgrade stack' UNION ALL
SELECT 'CLUSTER.RUN_CUSTOM_COMMAND', 'Perform custom cluster-level actions' UNION ALL
+ SELECT 'CLUSTER.MANAGE_AUTO_START', 'Manage service auto-start configuration' UNION ALL
SELECT 'AMBARI.ADD_DELETE_CLUSTERS', 'Create new clusters' UNION ALL
SELECT 'AMBARI.RENAME_CLUSTER', 'Rename clusters' UNION ALL
SELECT 'AMBARI.MANAGE_SETTINGS', 'Manage settings' UNION ALL
@@ -1283,6 +1285,7 @@ BEGIN TRANSACTION
SELECT permission_id, 'SERVICE.MODIFY_CONFIGS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.MANAGE_CONFIG_GROUPS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.VIEW_OPERATIONAL_LOGS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'SERVICE.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_METRICS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_STATUS_INFO' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_CONFIGS' FROM adminpermission WHERE permission_name='SERVICE.ADMINISTRATOR' UNION ALL
@@ -1311,6 +1314,7 @@ BEGIN TRANSACTION
SELECT permission_id, 'SERVICE.MOVE' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'SERVICE.ENABLE_HA' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'SERVICE.VIEW_OPERATIONAL_LOGS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
+ SELECT permission_id, 'SERVICE.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_METRICS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_STATUS_INFO' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_CONFIGS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
@@ -1324,6 +1328,7 @@ BEGIN TRANSACTION
SELECT permission_id, 'CLUSTER.MANAGE_CONFIG_GROUPS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'CLUSTER.VIEW_ALERTS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'CLUSTER.MANAGE_CREDENTIALS' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
+ SELECT permission_id, 'CLUSTER.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR' UNION ALL
SELECT permission_id, 'CLUSTER.MANAGE_USER_PERSISTED_DATA' FROM adminpermission WHERE permission_name='CLUSTER.OPERATOR';
-- Set authorizations for Cluster Administrator role
@@ -1347,6 +1352,7 @@ BEGIN TRANSACTION
SELECT permission_id, 'SERVICE.ADD_DELETE_SERVICES' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.VIEW_OPERATIONAL_LOGS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.SET_SERVICE_USERS_GROUPS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'SERVICE.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_METRICS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_STATUS_INFO' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_CONFIGS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
@@ -1366,6 +1372,7 @@ BEGIN TRANSACTION
SELECT permission_id, 'CLUSTER.MANAGE_CONFIG_GROUPS' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.UPGRADE_DOWNGRADE_STACK' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.MANAGE_USER_PERSISTED_DATA' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'CLUSTER.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.RUN_CUSTOM_COMMAND' FROM adminpermission WHERE permission_name='CLUSTER.ADMINISTRATOR';
-- Set authorizations for Administrator role
@@ -1390,6 +1397,7 @@ BEGIN TRANSACTION
SELECT permission_id, 'SERVICE.ADD_DELETE_SERVICES' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.VIEW_OPERATIONAL_LOGS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'SERVICE.SET_SERVICE_USERS_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'SERVICE.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_METRICS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_STATUS_INFO' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'HOST.VIEW_CONFIGS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
@@ -1409,6 +1417,7 @@ BEGIN TRANSACTION
SELECT permission_id, 'CLUSTER.TOGGLE_KERBEROS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.UPGRADE_DOWNGRADE_STACK' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.MANAGE_USER_PERSISTED_DATA' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
+ SELECT permission_id, 'CLUSTER.MANAGE_AUTO_START' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'CLUSTER.RUN_CUSTOM_COMMAND' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'AMBARI.ADD_DELETE_CLUSTERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
SELECT permission_id, 'AMBARI.RENAME_CLUSTER' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
http://git-wip-us.apache.org/repos/asf/ambari/blob/d48b8d9b/ambari-server/src/test/java/org/apache/ambari/server/security/TestAuthenticationFactory.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/security/TestAuthenticationFactory.java b/ambari-server/src/test/java/org/apache/ambari/server/security/TestAuthenticationFactory.java
index a66a3c9..1e68f9d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/security/TestAuthenticationFactory.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/security/TestAuthenticationFactory.java
@@ -218,6 +218,8 @@ public class TestAuthenticationFactory {
RoleAuthorization.SERVICE_VIEW_STATUS_INFO,
RoleAuthorization.SERVICE_VIEW_OPERATIONAL_LOGS,
RoleAuthorization.CLUSTER_RUN_CUSTOM_COMMAND,
+ RoleAuthorization.SERVICE_MANAGE_AUTO_START,
+ RoleAuthorization.CLUSTER_MANAGE_AUTO_START,
RoleAuthorization.CLUSTER_MANAGE_USER_PERSISTED_DATA)));
return permissionEntity;
}
@@ -257,6 +259,8 @@ public class TestAuthenticationFactory {
RoleAuthorization.SERVICE_MANAGE_CONFIG_GROUPS,
RoleAuthorization.CLUSTER_MANAGE_USER_PERSISTED_DATA,
RoleAuthorization.SERVICE_VIEW_OPERATIONAL_LOGS,
+ RoleAuthorization.SERVICE_MANAGE_AUTO_START,
+ RoleAuthorization.CLUSTER_MANAGE_AUTO_START,
RoleAuthorization.CLUSTER_MANAGE_CREDENTIALS)));
return permissionEntity;
}
@@ -291,6 +295,7 @@ public class TestAuthenticationFactory {
RoleAuthorization.SERVICE_VIEW_METRICS,
RoleAuthorization.SERVICE_VIEW_STATUS_INFO,
RoleAuthorization.SERVICE_VIEW_OPERATIONAL_LOGS,
+ RoleAuthorization.SERVICE_MANAGE_AUTO_START,
RoleAuthorization.CLUSTER_MANAGE_USER_PERSISTED_DATA)));
return permissionEntity;
}
[08/26] ambari git commit: AMBARI-19247 Add log to stack_select for
details on which role to get version info (dili)
Posted by nc...@apache.org.
AMBARI-19247 Add log to stack_select for details on which role to get version info (dili)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/51c4f92c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/51c4f92c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/51c4f92c
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 51c4f92c12c876119cca0f0fc0269597c004dba1
Parents: 688830c
Author: Di Li <di...@apache.org>
Authored: Tue Dec 20 15:41:29 2016 -0500
Committer: Di Li <di...@apache.org>
Committed: Tue Dec 20 15:41:29 2016 -0500
----------------------------------------------------------------------
.../resource_management/libraries/functions/stack_select.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/51c4f92c/ambari-common/src/main/python/resource_management/libraries/functions/stack_select.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/stack_select.py b/ambari-common/src/main/python/resource_management/libraries/functions/stack_select.py
index 513ceac..4f6ccd2 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/stack_select.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/stack_select.py
@@ -171,13 +171,14 @@ def get_role_component_current_stack_version():
role = default("/role", "")
role_command = default("/roleCommand", "")
stack_selector_name = stack_tools.get_stack_tool_name(stack_tools.STACK_SELECTOR_NAME)
-
+ Logger.info("Checking version for {0} via {1}".format(role, stack_selector_name))
if role in SERVER_ROLE_DIRECTORY_MAP:
stack_select_component = SERVER_ROLE_DIRECTORY_MAP[role]
elif role_command == "SERVICE_CHECK" and role in SERVICE_CHECK_DIRECTORY_MAP:
stack_select_component = SERVICE_CHECK_DIRECTORY_MAP[role]
if stack_select_component is None:
+ Logger.error("Mapping unavailable for role {0}. Skip checking its version.".format(role))
return None
current_stack_version = get_stack_version(stack_select_component)
[26/26] ambari git commit: Merge branch 'trunk' into
branch-dev-patch-upgrade
Posted by nc...@apache.org.
Merge branch 'trunk' into branch-dev-patch-upgrade
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/48079281
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/48079281
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/48079281
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 48079281714604afd445e6c89de116e49bfab5c0
Parents: 7a87817 bc1b7ab
Author: Nate Cole <nc...@hortonworks.com>
Authored: Thu Dec 22 12:07:50 2016 -0500
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Thu Dec 22 12:07:50 2016 -0500
----------------------------------------------------------------------
.../libraries/functions/stack_select.py | 3 +-
ambari-project/pom.xml | 3 +-
ambari-server/checkstyle.xml | 10 +-
ambari-server/sbin/ambari-server | 6 +-
.../ambari/server/agent/HeartbeatProcessor.java | 1 +
.../api/services/serializers/CsvSerializer.java | 15 +-
.../server/audit/event/AbstractAuditEvent.java | 10 +-
.../audit/event/AbstractUserAuditEvent.java | 8 +-
.../event/AccessUnauthorizedAuditEvent.java | 4 +
.../server/audit/event/LoginAuditEvent.java | 1 +
.../server/audit/event/LogoutAuditEvent.java | 1 +
.../audit/event/OperationStatusAuditEvent.java | 1 +
.../audit/event/TaskStatusAuditEvent.java | 1 +
.../kerberos/AbstractKerberosAuditEvent.java | 12 +-
.../ChangeSecurityStateKerberosAuditEvent.java | 1 +
.../CreateKeyTabKerberosAuditEvent.java | 1 +
.../CreatePrincipalKerberosAuditEvent.java | 1 +
.../DestroyPrincipalKerberosAuditEvent.java | 1 +
.../request/ActivateUserRequestAuditEvent.java | 1 +
.../request/AddAlertGroupRequestAuditEvent.java | 1 +
.../AddAlertTargetRequestAuditEvent.java | 1 +
.../request/AddBlueprintRequestAuditEvent.java | 1 +
.../AddComponentToHostRequestAuditEvent.java | 1 +
.../request/AddCredentialRequestAuditEvent.java | 1 +
.../event/request/AddHostRequestAuditEvent.java | 1 +
.../request/AddRepositoryRequestAuditEvent.java | 1 +
.../AddRepositoryVersionRequestAuditEvent.java | 1 +
.../request/AddRequestRequestAuditEvent.java | 1 +
.../request/AddUpgradeRequestAuditEvent.java | 1 +
.../AddUserToGroupRequestAuditEvent.java | 1 +
.../AddViewInstanceRequestAuditEvent.java | 1 +
.../request/AdminUserRequestAuditEvent.java | 1 +
.../BlueprintExportRequestAuditEvent.java | 1 +
.../ChangeAlertGroupRequestAuditEvent.java | 1 +
.../ChangeAlertTargetRequestAuditEvent.java | 1 +
...hangeRepositoryVersionRequestAuditEvent.java | 1 +
.../ChangeViewInstanceRequestAuditEvent.java | 1 +
.../ClientConfigDownloadRequestAuditEvent.java | 1 +
.../ClusterNameChangeRequestAuditEvent.java | 1 +
...ClusterPrivilegeChangeRequestAuditEvent.java | 1 +
.../ConfigurationChangeRequestAuditEvent.java | 1 +
.../request/CreateGroupRequestAuditEvent.java | 1 +
.../request/CreateUserRequestAuditEvent.java | 1 +
.../event/request/DefaultRequestAuditEvent.java | 54 ++
.../DeleteAlertGroupRequestAuditEvent.java | 1 +
.../DeleteAlertTargetRequestAuditEvent.java | 1 +
.../DeleteBlueprintRequestAuditEvent.java | 1 +
.../request/DeleteGroupRequestAuditEvent.java | 1 +
.../request/DeleteHostRequestAuditEvent.java | 1 +
...eleteRepositoryVersionRequestAuditEvent.java | 1 +
.../request/DeleteServiceRequestAuditEvent.java | 1 +
.../request/DeleteUserRequestAuditEvent.java | 1 +
.../DeleteViewInstanceRequestAuditEvent.java | 1 +
.../MembershipChangeRequestAuditEvent.java | 1 +
.../PrivilegeChangeRequestAuditEvent.java | 1 +
.../RemoveUserFromGroupRequestAuditEvent.java | 1 +
.../StartOperationRequestAuditEvent.java | 1 +
.../UpdateRepositoryRequestAuditEvent.java | 1 +
.../UpdateUpgradeItemRequestAuditEvent.java | 1 +
.../UserPasswordChangeRequestAuditEvent.java | 1 +
.../ViewPrivilegeChangeRequestAuditEvent.java | 1 +
.../server/audit/request/RequestAuditEvent.java | 31 +-
.../eventcreator/DefaultEventCreator.java | 4 +-
.../server/bootstrap/BSHostStatusCollector.java | 12 +-
.../ambari/server/bootstrap/BSRunner.java | 2 +-
.../AmbariManagementControllerImpl.java | 279 +++++++--
.../gsinstaller/ClusterDefinition.java | 9 +-
.../internal/AbstractProviderModule.java | 4 +-
.../internal/ComponentResourceProvider.java | 6 +-
.../internal/ConfigurationResourceProvider.java | 12 +-
.../internal/HostResourceProvider.java | 26 +-
.../CachedRoleCommandOrderProvider.java | 6 +-
.../server/metadata/RoleCommandOrder.java | 3 +-
.../server/orm/entities/AlertGroupEntity.java | 30 +-
.../server/orm/entities/AlertTargetEntity.java | 28 +-
.../AmbariAuthorizationFilter.java | 2 +
.../AmbariLdapAuthoritiesPopulator.java | 21 +-
.../authorization/RoleAuthorization.java | 8 +-
.../security/encryption/CredentialProvider.java | 13 +-
.../kerberos/IPAKerberosOperationHandler.java | 16 +-
.../kerberos/MITKerberosOperationHandler.java | 5 +-
.../stack/QuickLinksConfigurationModule.java | 4 -
.../apache/ambari/server/stack/ThemeModule.java | 4 -
.../ambari/server/state/ConfigHelper.java | 15 +-
.../apache/ambari/server/state/ServiceInfo.java | 28 +-
.../server/state/cluster/ClusterImpl.java | 3 +-
.../server/upgrade/SchemaUpgradeHelper.java | 24 +-
.../server/upgrade/UpgradeCatalog250.java | 71 +++
.../apache/ambari/server/utils/Closeables.java | 72 +++
.../server/view/ViewDirectoryWatcher.java | 8 +-
.../apache/ambari/server/view/ViewRegistry.java | 24 +-
.../server/view/ViewURLStreamProvider.java | 3 +-
ambari-server/src/main/python/ambari-server.py | 14 +-
.../main/python/ambari_server/kerberos_setup.py | 99 ++++
.../main/python/ambari_server/setupActions.py | 1 +
.../main/resources/Ambari-DDL-Derby-CREATE.sql | 9 +
.../main/resources/Ambari-DDL-MySQL-CREATE.sql | 9 +
.../main/resources/Ambari-DDL-Oracle-CREATE.sql | 9 +
.../resources/Ambari-DDL-Postgres-CREATE.sql | 9 +
.../resources/Ambari-DDL-SQLAnywhere-CREATE.sql | 9 +
.../resources/Ambari-DDL-SQLServer-CREATE.sql | 9 +
.../ATLAS/0.1.0.2.3/package/scripts/params.py | 6 +
.../HDFS/2.1.0.2.0/configuration/hdfs-log4j.xml | 50 +-
.../2.1.0.2.0/package/scripts/params_linux.py | 4 +-
.../2.1.0.2.0/package/scripts/params_windows.py | 2 +-
.../3.0.0.3.0/package/scripts/params_linux.py | 2 +-
.../0.5.0.2.2/package/scripts/params_linux.py | 2 +-
.../2.1.0.2.0/package/scripts/params_linux.py | 2 +-
.../3.0.0.3.0/package/scripts/params_linux.py | 2 +-
.../0.6.0.2.5/package/scripts/master.py | 21 +-
.../2.0.6/hooks/before-START/scripts/params.py | 10 +-
.../scripts/shared_initialization.py | 2 +-
.../stacks/HDP/2.0.6/services/stack_advisor.py | 2 +-
.../services/HDFS/configuration/hdfs-log4j.xml | 50 +-
.../configuration/application-properties.xml | 3 +-
.../services/ATLAS/themes/theme_version_2.json | 2 +-
.../HDP/2.6/services/ZEPPELIN/metainfo.xml | 2 +-
.../3.0/hooks/before-START/scripts/params.py | 2 +-
.../server/agent/TestHeartbeatHandler.java | 4 +-
.../AmbariCustomCommandExecutionHelperTest.java | 26 +-
.../internal/MemberResourceProviderTest.java | 1 -
.../UpgradeSummaryResourceProviderTest.java | 2 +-
.../logging/LogQueryResponseTest.java | 188 +++---
.../LogSearchDataRetrievalServiceTest.java | 8 -
.../logging/LoggingRequestHelperImplTest.java | 284 +++------
.../server/orm/dao/AlertDispatchDAOTest.java | 51 +-
.../security/TestAuthenticationFactory.java | 5 +
...ariAuthorizationProviderDisableUserTest.java | 2 +-
.../TestAmbariLdapAuthoritiesPopulator.java | 63 +-
.../server/state/ConfigMergeHelperTest.java | 12 +-
.../QuickLinksProfileParserTest.java | 2 +-
.../server/testing/DeadlockedThreadsTest.java | 14 +-
.../server/topology/BlueprintImplTest.java | 1 -
.../ClusterDeployWithStartOnlyTest.java | 1 -
...InstallWithoutStartOnComponentLevelTest.java | 1 -
.../ClusterInstallWithoutStartTest.java | 1 -
.../server/upgrade/UpgradeCatalog210Test.java | 6 +-
.../server/upgrade/UpgradeCatalog221Test.java | 5 +-
.../server/upgrade/UpgradeCatalog250Test.java | 153 ++++-
.../ambari/server/utils/CloseablesTest.java | 91 +++
.../hooks/before-START/test_before_start.py | 8 +-
.../stacks/2.2/common/test_stack_advisor.py | 2 +-
ambari-web/app/config.js | 1 +
.../global/background_operations_controller.js | 60 +-
.../controllers/global/cluster_controller.js | 179 +++---
.../global/configuration_controller.js | 14 +-
.../app/controllers/global/update_controller.js | 5 +-
.../global/user_settings_controller.js | 67 ++-
.../alert_definitions_actions_controller.js | 48 +-
.../alerts/definition_configs_controller.js | 182 +++---
ambari-web/app/controllers/main/host/details.js | 294 ++++-----
ambari-web/app/models/alerts/alert_config.js | 34 +-
ambari-web/app/styles/alerts.less | 2 +-
ambari-web/app/styles/application.less | 4 +
ambari-web/app/styles/dashboard.less | 21 +-
ambari-web/app/styles/wizard.less | 3 -
.../admin/highAvailability/nameNode/step1.hbs | 26 +-
.../main/dashboard/plus_button_filter.hbs | 14 +-
.../app/templates/main/host/addHost/step4.hbs | 56 +-
.../host/details/addDeleteComponentPopup.hbs | 6 +-
.../main/service/all_services_actions.hbs | 4 +-
ambari-web/app/views/main/dashboard/widgets.js | 1 -
.../global/background_operations_test.js | 241 +++++++-
.../global/cluster_controller_test.js | 592 +++++++++++++++++++
.../global/configuration_controller_test.js | 163 +++++
.../global/errors_handler_controller_test.js | 10 +
.../global/update_controller_test.js | 122 ++++
.../global/user_settings_controller_test.js | 300 ++++++++++
.../definitions_configs_controller_test.js | 76 +--
.../test/controllers/main/host/details_test.js | 112 +---
170 files changed, 3386 insertions(+), 1463 deletions(-)
----------------------------------------------------------------------
[22/26] ambari git commit: AMBARI-19268 ulimit override missing from
upgrade catalogs (dsen)
Posted by nc...@apache.org.
AMBARI-19268 ulimit override missing from upgrade catalogs (dsen)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/633ac3bd
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/633ac3bd
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/633ac3bd
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 633ac3bd532654ea0eec9159d666f9cb43446b5d
Parents: 0111c84
Author: Dmytro Sen <ds...@apache.org>
Authored: Thu Dec 22 15:37:47 2016 +0200
Committer: Dmytro Sen <ds...@apache.org>
Committed: Thu Dec 22 15:37:47 2016 +0200
----------------------------------------------------------------------
.../server/upgrade/UpgradeCatalog250.java | 41 ++++++++++++++++++++
.../server/upgrade/UpgradeCatalog250Test.java | 5 +++
2 files changed, 46 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/633ac3bd/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
index 7a385f3..72b2192 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
@@ -57,6 +57,7 @@ public class UpgradeCatalog250 extends AbstractUpgradeCatalog {
protected static final String GROUPS_TABLE = "groups";
protected static final String GROUP_TYPE_COL = "group_type";
private static final String AMS_ENV = "ams-env";
+ private static final String HADOOP_ENV = "hadoop-env";
private static final String KAFKA_BROKER = "kafka-broker";
private static final String KAFKA_TIMELINE_METRICS_HOST = "kafka.timeline.metrics.host";
@@ -146,6 +147,7 @@ public class UpgradeCatalog250 extends AbstractUpgradeCatalog {
protected void executeDMLUpdates() throws AmbariException, SQLException {
addNewConfigurationsFromXml();
updateAMSConfigs();
+ updateHadoopEnvConfigs();
updateKafkaConfigs();
updateHIVEInteractiveConfigs();
updateTEZInteractiveConfigs();
@@ -299,6 +301,45 @@ public class UpgradeCatalog250 extends AbstractUpgradeCatalog {
}
}
+
+ protected void updateHadoopEnvConfigs() throws AmbariException {
+ AmbariManagementController ambariManagementController = injector.getInstance(
+ AmbariManagementController.class);
+ Clusters clusters = ambariManagementController.getClusters();
+
+ if (clusters != null) {
+ Map<String, Cluster> clusterMap = clusters.getClusters();
+ Map<String, String> prop = new HashMap<String, String>();
+
+ if (clusterMap != null && !clusterMap.isEmpty()) {
+ for (final Cluster cluster : clusterMap.values()) {
+ /***
+ * Append "ulimit -l" from hadoop-env.sh
+ */
+ String content = null;
+ if (cluster.getDesiredConfigByType(HADOOP_ENV) != null) {
+ content = cluster.getDesiredConfigByType(HADOOP_ENV).getProperties().get("content");
+ }
+
+ if (content != null && !content.contains("ulimit")) {
+ content += "\n" +
+ "{% if is_datanode_max_locked_memory_set %}\n" +
+ "# Fix temporary bug, when ulimit from conf files is not picked up, without full relogin. \n" +
+ "# Makes sense to fix only when runing DN as root \n" +
+ "if [ \"$command\" == \"datanode\" ] && [ \"$EUID\" -eq 0 ] && [ -n \"$HADOOP_SECURE_DN_USER\" ]; then\n" +
+ " ulimit -l {{datanode_max_locked_memory}}\n" +
+ "fi\n" +
+ "{% endif %}";
+
+ prop.put("content", content);
+ updateConfigurationPropertiesForCluster(cluster, "hadoop-env",
+ prop, true, false);
+ }
+ }
+ }
+ }
+ }
+
/**
* Creates the servicecomponent_version table
* @throws SQLException
http://git-wip-us.apache.org/repos/asf/ambari/blob/633ac3bd/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
index 8568a19..f2424a1 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
@@ -267,6 +267,7 @@ public class UpgradeCatalog250Test {
@Test
public void testExecuteDMLUpdates() throws Exception {
Method updateAmsConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateAMSConfigs");
+ Method updateHadoopEnvConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateHadoopEnvConfigs");
Method updateKafkaConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateKafkaConfigs");
Method updateHiveLlapConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateHiveLlapConfigs");
Method updateHIVEInteractiveConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateHIVEInteractiveConfigs");
@@ -278,6 +279,7 @@ public class UpgradeCatalog250Test {
UpgradeCatalog250 upgradeCatalog250 = createMockBuilder(UpgradeCatalog250.class)
.addMockedMethod(updateAmsConfigs)
+ .addMockedMethod(updateHadoopEnvConfigs)
.addMockedMethod(updateKafkaConfigs)
.addMockedMethod(updateHiveLlapConfigs)
.addMockedMethod(addNewConfigurationsFromXml)
@@ -291,6 +293,9 @@ public class UpgradeCatalog250Test {
upgradeCatalog250.updateAMSConfigs();
expectLastCall().once();
+ upgradeCatalog250.updateHadoopEnvConfigs();
+ expectLastCall().once();
+
upgradeCatalog250.addNewConfigurationsFromXml();
expectLastCall().once();
[25/26] ambari git commit: AMBARI-19282. HA HDFS propreties may be
written in different case, which prevents operations (aonishuk)
Posted by nc...@apache.org.
AMBARI-19282. HA HDFS propreties may be written in different case, which prevents operations (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bc1b7ab8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bc1b7ab8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bc1b7ab8
Branch: refs/heads/branch-dev-patch-upgrade
Commit: bc1b7ab8c0f290879ce878a9c8cd028ecb51d45f
Parents: a100c0b
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Thu Dec 22 18:44:30 2016 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Thu Dec 22 18:44:30 2016 +0200
----------------------------------------------------------------------
.../common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py | 2 +-
.../HDFS/2.1.0.2.0/package/scripts/params_windows.py | 2 +-
.../common-services/KNOX/0.5.0.2.2/package/scripts/params_linux.py | 2 +-
.../stacks/HDP/2.0.6/hooks/before-START/scripts/params.py | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc1b7ab8/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py
index b04fce3..21e7b68 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py
@@ -296,7 +296,7 @@ if dfs_ha_namenode_ids:
if dfs_ha_enabled:
for nn_id in dfs_ha_namemodes_ids_list:
nn_host = config['configurations']['hdfs-site'][format('dfs.namenode.rpc-address.{dfs_ha_nameservices}.{nn_id}')]
- if hostname in nn_host:
+ if hostname.lower() in nn_host.lower():
namenode_id = nn_id
namenode_rpc = nn_host
# With HA enabled namenode_address is recomputed
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc1b7ab8/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_windows.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_windows.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_windows.py
index 70d95a6..1e47c29 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_windows.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_windows.py
@@ -59,7 +59,7 @@ if dfs_ha_namenode_ids:
if dfs_ha_enabled:
for nn_id in dfs_ha_namemodes_ids_list:
nn_host = config['configurations']['hdfs-site'][format('dfs.namenode.rpc-address.{dfs_ha_nameservices}.{nn_id}')]
- if hostname in nn_host:
+ if hostname.lower() in nn_host.lower():
namenode_id = nn_id
namenode_rpc = nn_host
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc1b7ab8/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/params_linux.py
index 6f63836..7a63e25 100644
--- a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/params_linux.py
@@ -124,7 +124,7 @@ if dfs_ha_namenode_ids:
if dfs_ha_enabled:
for nn_id in dfs_ha_namemodes_ids_list:
nn_host = config['configurations']['hdfs-site'][format('dfs.namenode.rpc-address.{dfs_ha_nameservices}.{nn_id}')]
- if hostname in nn_host:
+ if hostname.lower() in nn_host.lower():
namenode_id = nn_id
namenode_rpc = nn_host
# With HA enabled namenode_address is recomputed
http://git-wip-us.apache.org/repos/asf/ambari/blob/bc1b7ab8/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
index 2ade512..92abd57 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
@@ -290,7 +290,7 @@ if dfs_ha_namenode_ids:
if dfs_ha_enabled:
for nn_id in dfs_ha_namemodes_ids_list:
nn_host = config['configurations']['hdfs-site'][format('dfs.namenode.rpc-address.{dfs_ha_nameservices}.{nn_id}')]
- if hostname in nn_host:
+ if hostname.lower() in nn_host.lower():
namenode_id = nn_id
namenode_rpc = nn_host
pass
[21/26] ambari git commit: AMBARI-19281 Display properties for all
affected services before adding or deleting ZooKeeper Server. (ababiichuk)
Posted by nc...@apache.org.
AMBARI-19281 Display properties for all affected services before adding or deleting ZooKeeper Server. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0111c847
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0111c847
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0111c847
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 0111c847ddc2367b8b1046f74d6ce65d6bbb331e
Parents: bd3df7d
Author: ababiichuk <ab...@hortonworks.com>
Authored: Thu Dec 22 14:36:13 2016 +0200
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Thu Dec 22 14:36:13 2016 +0200
----------------------------------------------------------------------
ambari-web/app/controllers/main/host/details.js | 294 +++++++------------
.../host/details/addDeleteComponentPopup.hbs | 6 +-
.../test/controllers/main/host/details_test.js | 110 +------
3 files changed, 108 insertions(+), 302 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/0111c847/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index 5f2af2c..c38838f 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -45,12 +45,18 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
isFromHosts: false,
/**
- * Are we adding hive server2 component
+ * Determines whether we are adding Hive Server2 component
* @type {bool}
*/
addHiveServer: false,
/**
+ * Determines whether we are adding ZooKeeper Server component
+ * @type {bool}
+ */
+ addZooKeeperServer: false,
+
+ /**
* path to page visited before
* @type {string}
*/
@@ -73,12 +79,12 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
*/
isOozieServerAddable: true,
- isConfigsLoaded: false,
+ isConfigsLoadingInProgress: false,
addDeleteComponentsMap: {
'ZOOKEEPER_SERVER': {
- deletePropertyName: 'fromDeleteZkServer',
- configsCallbackName: 'loadStormConfigs'
+ addPropertyName: 'addZooKeeperServer',
+ deletePropertyName: 'fromDeleteZkServer'
},
'HIVE_METASTORE': {
deletePropertyName: 'deleteHiveMetaStore',
@@ -91,8 +97,8 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
configsCallbackName: 'loadWebHCatConfigs'
},
'HIVE_SERVER': {
+ addPropertyName: 'addHiveServer',
deletePropertyName: 'deleteHiveServer',
- hostPropertyName: '',
configsCallbackName: 'loadHiveConfigs'
},
'NIMBUS': {
@@ -107,6 +113,44 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
}
},
+ zooKeeperRelatedServices: [
+ {
+ serviceName: 'HIVE',
+ typesToLoad: ['hive-site', 'webhcat-site'],
+ typesToSave: ['hive-site', 'webhcat-site']
+ },
+ {
+ serviceName: 'YARN',
+ typesToLoad: ['yarn-site', 'zoo.cfg'],
+ typesToSave: ['yarn-site']
+ },
+ {
+ serviceName: 'HBASE',
+ typesToLoad: ['hbase-site'],
+ typesToSave: ['hbase-site']
+ },
+ {
+ serviceName: 'ACCUMULO',
+ typesToLoad: ['accumulo-site'],
+ typesToSave: ['accumulo-site']
+ },
+ {
+ serviceName: 'KAFKA',
+ typesToLoad: ['kafka-broker'],
+ typesToSave: ['kafka-broker']
+ },
+ {
+ serviceName: 'ATLAS',
+ typesToLoad: ['application-properties', 'infra-solr-env'],
+ typesToSave: ['application-properties']
+ },
+ {
+ serviceName: 'STORM',
+ typesToLoad: ['storm-site'],
+ typesToSave: ['storm-site']
+ }
+ ],
+
addDeleteComponentPopupBody: Em.View.extend({
templateName: require('templates/main/host/details/addDeleteComponentPopup'),
isReconfigure: false,
@@ -373,7 +417,6 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
if ($(event.target).closest('li').hasClass('disabled')) {
return;
}
- var self = this;
var component = event.context;
var componentName = component.get('componentName');
var displayName = component.get('displayName');
@@ -381,20 +424,10 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
var returnFunc;
var componentsMapItem = this.get('addDeleteComponentsMap')[componentName];
if (componentsMapItem) {
- var primary;
if (componentsMapItem.deletePropertyName) {
this.set(componentsMapItem.deletePropertyName, true);
}
- if (componentName === 'ZOOKEEPER_SERVER') {
- primary = function () {
- this.set('fromDeleteZkServer', true);
- this.updateStormConfigs();
- this.isServiceMetricsLoaded(function () {
- self.loadConfigs();
- });
- }
- }
- returnFunc = this.showDeleteComponentPopup(component, true, componentsMapItem.configsCallbackName, primary);
+ returnFunc = this.showDeleteComponentPopup(component, true, componentsMapItem.configsCallbackName);
} else if (componentName === 'JOURNALNODE') {
returnFunc = App.showConfirmationPopup(function () {
App.router.transitionTo('main.services.manageJournalNode');
@@ -405,7 +438,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
return returnFunc;
},
- showDeleteComponentPopup: function (component, isReconfigure, callbackName, primary) {
+ showDeleteComponentPopup: function (component, isReconfigure, callbackName) {
var self = this,
isLastComponent = (this.getTotalComponent(component) === 1),
componentName = component.get('componentName'),
@@ -416,7 +449,10 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
groups: [],
propertiesToChange: []
};
- this.loadConfigs(callbackName, configs);
+ this.set('isConfigsLoadingInProgress', true);
+ this.isServiceMetricsLoaded(function () {
+ self.loadConfigs(callbackName, configs);
+ });
}
return App.ModalPopup.show({
header: Em.I18n.t('popup.confirmation.commonHeader'),
@@ -439,8 +475,8 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
}),
isChecked: false,
disablePrimary: function () {
- return (isReconfigure && !this.get('controller.isConfigsLoaded')) || !this.get('isChecked');
- }.property('controller.isConfigsLoaded', 'isChecked'),
+ return (isReconfigure && this.get('controller.isConfigsLoadingInProgress')) || !this.get('isChecked');
+ }.property('controller.isConfigsLoadingInProgress', 'isChecked'),
onPrimary: function () {
this._super();
if (isReconfigure) {
@@ -449,9 +485,6 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
self._doDeleteHostComponent(componentName, function () {
if (isReconfigure) {
self.saveConfigsBatch(configs.groups, componentName);
- if (primary) {
- primary.call(self);
- }
}
self.set('redrawComponents', true);
});
@@ -658,9 +691,10 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
if (componentsMapItem.hostPropertyName) {
this.set(componentsMapItem.hostPropertyName, hostName);
}
- if (componentName === 'HIVE_METASTORE') {
+ if (componentsMapItem.addPropertyName) {
+ this.set(componentsMapItem.addPropertyName, true);
primary = function () {
- this.set('addHiveServer', false);
+ this.set(componentsMapItem.addPropertyName, false);
};
}
returnFunc = self.showAddComponentPopup(component, hostName, null, true, componentsMapItem.configsCallbackName, primary);
@@ -686,7 +720,10 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
groups: [],
propertiesToChange: []
};
- this.loadConfigs(callbackName, configs);
+ this.set('isConfigsLoadingInProgress', true);
+ this.isServiceMetricsLoaded(function () {
+ self.loadConfigs(callbackName, configs);
+ });
}
return App.ModalPopup.show({
header: Em.I18n.t('popup.confirmation.commonHeader'),
@@ -703,8 +740,8 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
propertiesToChange: isReconfigure ? configs.propertiesToChange : []
}),
disablePrimary: function () {
- return isReconfigure && !this.get('controller.isConfigsLoaded');
- }.property('controller.isConfigsLoaded'),
+ return isReconfigure && this.get('controller.isConfigsLoadingInProgress');
+ }.property('controller.isConfigsLoadingInProgress'),
onPrimary: function () {
this._super();
if (isReconfigure) {
@@ -737,17 +774,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
this.mimicWorkStatusChange(params.component, App.HostComponentStatus.installing, App.HostComponentStatus.stopped);
}
- this.showBackgroundOperationsPopup(function () {
- if (params.componentName === 'ZOOKEEPER_SERVER' || params.componentName === 'HIVE_SERVER') {
- self.set(params.componentName === 'ZOOKEEPER_SERVER' ? 'zkRequestId' : 'hiveRequestId', data.Requests.id);
- self.addObserver(
- 'App.router.backgroundOperationsController.serviceTimestamp',
- self,
- (params.componentName === 'ZOOKEEPER_SERVER' ? self.checkZkConfigs : self.checkHiveDone)
- );
- params.componentName === 'ZOOKEEPER_SERVER' ? self.checkZkConfigs() : self.checkHiveDone();
- }
- });
+ this.showBackgroundOperationsPopup();
return true;
},
@@ -763,22 +790,6 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
},
/**
- * Call load tags
- * @method checkHiveDone
- */
- checkHiveDone: function () {
- var bg = App.router.get('backgroundOperationsController.services').findProperty('id', this.get('hiveRequestId'));
- if (bg && !bg.get('isRunning')) {
- var self = this;
- this.removeObserver('App.router.backgroundOperationsController.serviceTimestamp', this, this.checkHiveDone);
- setTimeout(function () {
- self.set('addHiveServer', true);
- self.loadConfigs("loadHiveConfigs");
- }, App.get('componentsUpdateInterval'));
- }
- },
-
- /**
* Success callback for load configs request
* @param {object} data
* @method loadOozieConfigs
@@ -851,6 +862,13 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
if (!Em.isNone(removedHost)) {
Em.set(removedHost, 'isInstalled', false);
}
+ } else if (this.get('addZooKeeperServer')) {
+ this.set('addZooKeeperServer', false);
+ masterComponents.push({
+ component: 'ZOOKEEPER_SERVER',
+ hostName: this.get('content.hostName'),
+ isInstalled: true
+ });
}
var dependencies = {
zkClientPort: zkPort,
@@ -947,8 +965,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
}
];
if (params.configs) {
- params.configs.groups = groups;
- this.set('isConfigsLoaded', true);
+ params.configs.groups.pushObjects(groups);
} else {
this.saveConfigsBatch(groups, 'NIMBUS', nimbusHost);
}
@@ -1093,8 +1110,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
}
];
if (params.configs) {
- params.configs.groups = groups;
- this.set('isConfigsLoaded', true);
+ params.configs.groups.pushObjects(groups);
} else {
var args = [groups];
var componentName = this.get('addHiveServer') ? 'HIVE_SERVER' : (hiveMetastoreHost ? 'HIVE_METASTORE' : 'WEBHCAT_SERVER');
@@ -1288,8 +1304,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
typeConfigs[property.name] = newValue;
});
if (params.configs) {
- params.configs.groups = groups;
- this.set('isConfigsLoaded', true);
+ params.configs.groups.pushObjects(groups);
} else {
this.saveConfigsBatch(groups, 'RANGER_KMS_SERVER', hostToInstall);
}
@@ -1390,47 +1405,22 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
},
/**
- * Update storm config
- * @method updateStormConfigs
- */
- updateStormConfigs: function () {
- if (App.Service.find('STORM').get('isLoaded') && App.StackService.find('STORM').compareCurrentVersion('0.10') > -1) {
- this.loadConfigs("loadStormConfigs");
- }
- },
-
- /**
- * Load tags
- * @method checkZkConfigs
- */
- checkZkConfigs: function () {
- var bg = App.router.get('backgroundOperationsController.services').findProperty('id', this.get('zkRequestId'));
- if (bg && !bg.get('isRunning')) {
- var self = this;
- this.removeObserver('App.router.backgroundOperationsController.serviceTimestamp', this, this.checkZkConfigs);
- setTimeout(function () {
- self.updateStormConfigs();
- var callback = function () {
- self.loadConfigs();
- };
- self.isServiceMetricsLoaded(callback);
- }, App.get('componentsUpdateInterval'));
- }
- },
-
- /**
* Load configs
* This function when used without a callback should be always used from successcallback function of the promise `App.router.get('mainController').isLoading.call(App.router.get('clusterController'), 'isServiceContentFullyLoaded').done(promise)`
* This is required to make sure that service metrics API determining the HA state of components is loaded
* @method loadConfigs
*/
loadConfigs: function (callback, configs) {
- this.set('isConfigsLoaded', false);
+ var self = this;
+ this.set('isConfigsLoadingInProgress', true);
App.ajax.send({
name: 'config.tags',
sender: this,
success: callback ? callback : 'loadConfigsSuccessCallback',
error: 'onLoadConfigsErrorCallback',
+ callback: function () {
+ self.set('isConfigsLoadingInProgress', false);
+ },
data: {
configs: configs
}
@@ -1480,30 +1470,13 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
if (App.get('isHaEnabled')) {
urlParams.push('(type=core-site&tag=' + data.Clusters.desired_configs['core-site'].tag + ')');
}
- if (services.someProperty('serviceName', 'HBASE')) {
- urlParams.push('(type=hbase-site&tag=' + data.Clusters.desired_configs['hbase-site'].tag + ')');
- }
- if (services.someProperty('serviceName', 'HIVE')) {
- urlParams.push('(type=webhcat-site&tag=' + data.Clusters.desired_configs['webhcat-site'].tag + ')');
- urlParams.push('(type=hive-site&tag=' + data.Clusters.desired_configs['hive-site'].tag + ')');
- }
- if (services.someProperty('serviceName', 'STORM')) {
- urlParams.push('(type=storm-site&tag=' + data.Clusters.desired_configs['storm-site'].tag + ')');
- }
- if (services.someProperty('serviceName', 'YARN')) {
- urlParams.push('(type=yarn-site&tag=' + data.Clusters.desired_configs['yarn-site'].tag + ')');
- urlParams.push('(type=zoo.cfg&tag=' + data.Clusters.desired_configs['zoo.cfg'].tag + ')');
- }
- if (services.someProperty('serviceName', 'ACCUMULO')) {
- urlParams.push('(type=accumulo-site&tag=' + data.Clusters.desired_configs['accumulo-site'].tag + ')');
- }
- if (services.someProperty('serviceName', 'KAFKA')) {
- urlParams.push('(type=kafka-broker&tag=' + data.Clusters.desired_configs['kafka-broker'].tag + ')');
- }
- if (services.someProperty('serviceName', 'ATLAS')) {
- urlParams.push('(type=application-properties&tag=' + data.Clusters.desired_configs['application-properties'].tag + ')');
- urlParams.push('(type=infra-solr-env&tag=' + data.Clusters.desired_configs['infra-solr-env'].tag + ')');
- }
+ this.get('zooKeeperRelatedServices').forEach(function (service) {
+ if (services.someProperty('serviceName', service.serviceName)) {
+ service.typesToLoad.forEach(function (type) {
+ urlParams.push('(type=' + type + '&tag=' + data.Clusters.desired_configs[type].tag + ')');
+ });
+ }
+ });
return urlParams;
},
@@ -1523,82 +1496,23 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
}, this);
this.updateZkConfigs(configs, params.configs);
- var groups = [
- {
- properties: {
- 'hive-site': configs['hive-site'],
- 'webhcat-site': configs['webhcat-site']
- },
- properties_attributes: {
- 'hive-site': attributes['hive-site'],
- 'webhcat-site': attributes['webhcat-site']
- }
- }
- ];
+ var groups = [];
var installedServiceNames = App.Service.find().mapProperty('serviceName');
- if (installedServiceNames.contains('YARN')) {
- groups.push(
- {
- properties: {
- 'yarn-site': configs['yarn-site']
- },
- properties_attributes: {
- 'yarn-site': attributes['yarn-site']
- }
- }
- );
- }
- if (installedServiceNames.contains('HBASE')) {
- groups.push(
- {
- properties: {
- 'hbase-site': configs['hbase-site']
- },
- properties_attributes: {
- 'hbase-site': attributes['hbase-site']
- }
- }
- );
- }
- if (installedServiceNames.contains('ACCUMULO')) {
- groups.push(
- {
- properties: {
- 'accumulo-site': configs['accumulo-site']
- },
- properties_attributes: {
- 'accumulo-site': attributes['accumulo-site']
- }
- }
- );
- }
- if (installedServiceNames.contains('KAFKA')) {
- groups.push(
- {
- properties: {
- 'kafka-broker': configs['kafka-broker']
- },
- properties_attributes: {
- 'kafka-broker': attributes['kafka-broker']
- }
- }
- );
- }
- if (installedServiceNames.contains('ATLAS')) {
- groups.push(
- {
- properties: {
- 'application-properties': configs['application-properties']
- },
- properties_attributes: {
- 'application-properties': attributes['application-properties']
- }
- }
- );
- }
+ this.get('zooKeeperRelatedServices').forEach(function (service) {
+ if (installedServiceNames.contains(service.serviceName)) {
+ var group = {
+ properties: {},
+ properties_attributes: {}
+ };
+ service.typesToSave.forEach(function (type) {
+ group.properties[type] = configs[type];
+ group.properties_attributes[type] = attributes[type];
+ });
+ groups.push(group);
+ }
+ });
if (params.configs) {
- params.configs.groups = groups;
- this.set('isConfigsLoaded', true);
+ params.configs.groups.pushObjects(groups);
} else {
this.saveConfigsBatch(groups, 'ZOOKEEPER_SERVER');
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/0111c847/ambari-web/app/templates/main/host/details/addDeleteComponentPopup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host/details/addDeleteComponentPopup.hbs b/ambari-web/app/templates/main/host/details/addDeleteComponentPopup.hbs
index 713ad8c..295acc8 100644
--- a/ambari-web/app/templates/main/host/details/addDeleteComponentPopup.hbs
+++ b/ambari-web/app/templates/main/host/details/addDeleteComponentPopup.hbs
@@ -25,14 +25,14 @@
</div>
{{/if}}
{{#if view.isReconfigure}}
- {{#if controller.isConfigsLoaded}}
+ {{#if controller.isConfigsLoadingInProgress}}
+ {{view App.SpinnerView}}
+ {{else}}
{{view.commonMessage}}
{{#if view.propertiesToChange.length}}
{{view App.DependentConfigsListView isAfterRecommendation=false recommendationsBinding="view.propertiesToChange"}}
{{/if}}
{{{view.manualKerberosWarning}}}
- {{else}}
- {{view App.SpinnerView}}
{{/if}}
{{else}}
<div>{{view.commonMessage}}</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/0111c847/ambari-web/test/controllers/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js
index cbebcf0..024e994 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -920,7 +920,7 @@ describe('App.MainHostDetailsController', function () {
it('HIVE is installed', function () {
loadService('HIVE');
- expect(controller.constructConfigUrlParams(data)).to.eql(['(type=webhcat-site&tag=1)', '(type=hive-site&tag=1)']);
+ expect(controller.constructConfigUrlParams(data)).to.eql(['(type=hive-site&tag=1)', '(type=webhcat-site&tag=1)']);
});
it('STORM is installed', function () {
@@ -2558,66 +2558,6 @@ describe('App.MainHostDetailsController', function () {
});
});
- describe('#checkZkConfigs()', function () {
- beforeEach(function () {
- sinon.stub(controller, 'removeObserver');
- sinon.stub(controller, 'loadConfigs');
- sinon.stub(controller, 'isServiceMetricsLoaded', Em.clb);
- this.stub = sinon.stub(App.router, 'get');
- sinon.stub(App.StackService, 'find').returns({
- compareCurrentVersion: function() {}
- })
- });
- afterEach(function () {
- controller.loadConfigs.restore();
- controller.removeObserver.restore();
- controller.isServiceMetricsLoaded.restore();
- this.stub.restore();
- App.StackService.find.restore();
- });
-
- it('No operations of ZOOKEEPER_SERVER', function () {
- this.stub.withArgs('backgroundOperationsController.services').returns([]);
- controller.checkZkConfigs();
- expect(controller.removeObserver.called).to.be.false;
- expect(controller.loadConfigs.called).to.be.false;
- });
-
- it('Operation of ZOOKEEPER_SERVER running', function () {
- this.stub.withArgs('backgroundOperationsController.services').returns([Em.Object.create({
- id: 1,
- isRunning: true
- })]);
- controller.set('zkRequestId', 1);
- controller.checkZkConfigs();
- expect(controller.removeObserver.called).to.be.false;
- expect(controller.loadConfigs.called).to.be.false;
- });
-
- describe('Operation of ZOOKEEPER_SERVER finished', function () {
-
- beforeEach(function () {
- this.stub.withArgs('backgroundOperationsController.services').returns([Em.Object.create({
- id: 1
- })]);
- this.clock = sinon.useFakeTimers();
- controller.set('zkRequestId', 1);
- controller.checkZkConfigs();
- });
-
- afterEach(function () {
- this.clock.restore();
- });
-
- it('loadConfigs is called after `componentsUpdateInterval`', function () {
- expect(controller.removeObserver.calledWith('App.router.backgroundOperationsController.serviceTimestamp', controller, controller.checkZkConfigs)).to.be.true;
- this.clock.tick(App.get('componentsUpdateInterval'));
- expect(controller.loadConfigs.calledOnce).to.be.true;
- });
-
- });
- });
-
describe('#_doDeleteHostComponentErrorCallback()', function () {
it('call showBackgroundOperationsPopup', function () {
controller._doDeleteHostComponentErrorCallback({}, 'textStatus', {}, {url: 'url'});
@@ -3387,54 +3327,6 @@ describe('App.MainHostDetailsController', function () {
});
});
- describe("#updateStormConfigs()", function () {
- beforeEach(function () {
- this.serviceMock = sinon.stub(App.Service, 'find');
- sinon.stub(controller, 'loadConfigs');
- this.mock = sinon.stub(App, 'get')
- this.stackServiceMock = sinon.stub(App.StackService, 'find');
- });
- afterEach(function () {
- this.serviceMock.restore();
- this.mock.restore();
- controller.loadConfigs.restore();
- this.stackServiceMock.restore();
- });
- it("should not update configs when storm not installed, storm version >= 0.10", function () {
- this.serviceMock.returns(Em.Object.create({
- isLoaded: false
- }));
- this.mock.returns(false);
- this.stackServiceMock.returns(App.StackService.createRecord({
- serviceVersion: '0.10.1.1'
- }));
- controller.updateStormConfigs();
- expect(controller.loadConfigs.called).to.be.false;
- });
- it("should not update configs when storm installed, storm version is less 0.10", function () {
- this.serviceMock.returns(Em.Object.create({
- isLoaded: true
- }));
- this.stackServiceMock.returns(App.StackService.createRecord({
- serviceVersion: '0.9.1.1'
- }));
- this.mock.returns(false);
- controller.updateStormConfigs();
- expect(controller.loadConfigs.called).to.be.false;
- });
- it("should update configs when storm installed, storm version >= 0.10", function () {
- this.serviceMock.returns(Em.Object.create({
- isLoaded: true
- }));
- this.stackServiceMock.returns(App.StackService.createRecord({
- serviceVersion: '0.10.1.1'
- }));
- this.mock.returns(true);
- controller.updateStormConfigs();
- expect(controller.loadConfigs.calledWith('loadStormConfigs')).to.be.true;
- });
- });
-
describe("#parseNnCheckPointTime", function () {
var tests = [
{