You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2016/10/31 12:23:48 UTC
[2/2] ambari git commit: AMBARI-18623. NPE when a non-existent host
is provided as part of the host filter (aonishuk)
AMBARI-18623. NPE when a non-existent host is provided as part of the host filter (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6dc5a23a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6dc5a23a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6dc5a23a
Branch: refs/heads/branch-2.5
Commit: 6dc5a23a76ad3053c2df884f49c6d9cabbd1999d
Parents: 005a9a0
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Mon Oct 31 14:23:30 2016 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Mon Oct 31 14:23:30 2016 +0200
----------------------------------------------------------------------
.../controller/AmbariCustomCommandExecutionHelper.java | 10 ++++++++++
1 file changed, 10 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/6dc5a23a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
index faa21cb..0cf46df 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
@@ -557,6 +557,16 @@ public class AmbariCustomCommandExecutionHelper {
candidateHosts = serviceHostComponents.keySet();
}
+ // check if all hostnames are valid.
+ for(String candidateHostName: candidateHosts) {
+ ServiceComponentHost serviceComponentHost = serviceHostComponents.get(candidateHostName);
+
+ if (serviceComponentHost == null) {
+ throw new AmbariException("Provided hostname = "
+ + candidateHostName + " is either not a valid cluster host or does not satisfy the filter condition.");
+ }
+ }
+
// Filter out hosts that are in maintenance mode - they should never be included in service checks
Set<String> hostsInMaintenanceMode = new HashSet<String>();
if (actionExecutionContext.isMaintenanceModeHostExcluded()) {