ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stoa...@apache.org
Subject [18/51] [abbrv] ambari git commit: Add delete component operation message and enhance it when querystring is set
Date Thu, 24 Mar 2016 12:08:50 GMT
Add delete component operation message and enhance it when querystring is set


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

Branch: refs/heads/audit_logging
Commit: 5f7cada801fd6aecac35098bee9b63d7d5fabfec
Parents: 9776661
Author: Daniel Gergely <dgergely@hortonworks.com>
Authored: Tue Feb 23 16:32:20 2016 +0100
Committer: Toader, Sebastian <stoader@hortonworks.com>
Committed: Thu Mar 24 13:06:47 2016 +0100

----------------------------------------------------------------------
 .../request/eventcreator/ComponentEventCreator.java     | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5f7cada8/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/ComponentEventCreator.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/ComponentEventCreator.java
b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/ComponentEventCreator.java
index 91dff07..4808fdc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/ComponentEventCreator.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/ComponentEventCreator.java
@@ -108,6 +108,10 @@ public class ComponentEventCreator implements RequestAuditEventCreator
{
   }
 
   private String getOperation(Request request) {
+    if(request.getRequestType() == Request.Type.DELETE) {
+      return "Delete component " + request.getResource().getKeyValueMap().get(Resource.Type.HostComponent);
+    }
+
     if (request.getBody().getRequestInfoProperties().containsKey(RequestOperationLevel.OPERATION_LEVEL_ID))
{
       String operation = "";
       switch (request.getBody().getRequestInfoProperties().get(RequestOperationLevel.OPERATION_LEVEL_ID))
{
@@ -116,6 +120,7 @@ public class ComponentEventCreator implements RequestAuditEventCreator
{
             if (map.containsKey(PropertyHelper.getPropertyId("HostRoles", "cluster_name")))
{
               operation = String.valueOf(map.get(PropertyHelper.getPropertyId("HostRoles",
"state"))) + ": all services"
                 + " on all hosts"
+                + (request.getBody().getQueryString().length() > 0 ? " that matches "
+ request.getBody().getQueryString() : "")
                 + " (" + request.getBody().getRequestInfoProperties().get(RequestOperationLevel.OPERATION_CLUSTER_ID)
+ ")";
               break;
             }
@@ -146,6 +151,13 @@ public class ComponentEventCreator implements RequestAuditEventCreator
{
       }
       return operation;
     }
+
+    for (Map<String, Object> map : request.getBody().getPropertySets()) {
+      if (map.containsKey(PropertyHelper.getPropertyId("HostRoles", "maintenance_state")))
{
+        return "Turn " + map.get(PropertyHelper.getPropertyId("HostRoles", "maintenance_state"))
+ " Maintenance Mode for " + map.get(PropertyHelper.getPropertyId("HostRoles", "component_name"));
+      }
+    }
+
     return null;
   }
 


Mime
View raw message