brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [1/5] incubator-brooklyn git commit: Use Sanitiser.sanitize when logging
Date Mon, 21 Dec 2015 11:41:35 GMT
Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master cde2ad5ab -> 9b7ad2e3c


Use Sanitiser.sanitize when logging

Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/70ed0e1e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/70ed0e1e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/70ed0e1e

Branch: refs/heads/master
Commit: 70ed0e1e965f284dc84fbe3c1b107071791bdde6
Parents: cde2ad5
Author: Aled Sage <aled.sage@gmail.com>
Authored: Sat Dec 19 19:50:41 2015 +0000
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Sat Dec 19 19:50:41 2015 +0000

----------------------------------------------------------------------
 .../org/apache/brooklyn/entity/group/DynamicClusterImpl.java  | 3 ++-
 .../location/byon/SingleMachineProvisioningLocation.java      | 7 +++++--
 .../apache/brooklyn/util/core/task/BasicExecutionManager.java | 3 ++-
 .../core/task/system/internal/SystemProcessTaskFactory.java   | 3 ++-
 4 files changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/70ed0e1e/core/src/main/java/org/apache/brooklyn/entity/group/DynamicClusterImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/entity/group/DynamicClusterImpl.java b/core/src/main/java/org/apache/brooklyn/entity/group/DynamicClusterImpl.java
index 756f665..b8e5c63 100644
--- a/core/src/main/java/org/apache/brooklyn/entity/group/DynamicClusterImpl.java
+++ b/core/src/main/java/org/apache/brooklyn/entity/group/DynamicClusterImpl.java
@@ -41,6 +41,7 @@ import org.apache.brooklyn.api.location.MachineProvisioningLocation;
 import org.apache.brooklyn.api.mgmt.Task;
 import org.apache.brooklyn.api.policy.Policy;
 import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.core.config.Sanitizer;
 import org.apache.brooklyn.core.config.render.RendererHints;
 import org.apache.brooklyn.core.effector.Effectors;
 import org.apache.brooklyn.core.entity.Entities;
@@ -855,7 +856,7 @@ public class DynamicClusterImpl extends AbstractGroupImpl implements DynamicClus
                 .put(CLUSTER_MEMBER_ID, sensors().get(NEXT_CLUSTER_MEMBER_ID).get())
                 .build();
         if (LOG.isDebugEnabled()) {
-            LOG.debug("Creating and adding a node to cluster {}({}) with properties {}",
new Object[] { this, getId(), createFlags });
+            LOG.debug("Creating and adding a node to cluster {}({}) with properties {}",
new Object[] { this, getId(), Sanitizer.sanitize(createFlags) });
         }
 
         // TODO should refactor to have a createNodeSpec; and spec should support initial
sensor values 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/70ed0e1e/core/src/main/java/org/apache/brooklyn/location/byon/SingleMachineProvisioningLocation.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/location/byon/SingleMachineProvisioningLocation.java
b/core/src/main/java/org/apache/brooklyn/location/byon/SingleMachineProvisioningLocation.java
index eb8c4f9..cba4966 100644
--- a/core/src/main/java/org/apache/brooklyn/location/byon/SingleMachineProvisioningLocation.java
+++ b/core/src/main/java/org/apache/brooklyn/location/byon/SingleMachineProvisioningLocation.java
@@ -23,6 +23,7 @@ import java.util.Map;
 import org.apache.brooklyn.api.location.MachineLocation;
 import org.apache.brooklyn.api.location.MachineProvisioningLocation;
 import org.apache.brooklyn.api.location.NoMachinesAvailableException;
+import org.apache.brooklyn.core.config.Sanitizer;
 import org.apache.brooklyn.util.core.flags.SetFromFlag;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -53,10 +54,12 @@ public class SingleMachineProvisioningLocation<T extends MachineLocation>
extend
         this.location = location;
     }
 
-    @SuppressWarnings("rawtypes")
+    @SuppressWarnings({ "rawtypes", "unchecked" })
     @Override
     public synchronized T obtain(Map flags) throws NoMachinesAvailableException {
-        log.info("Flags {} passed to newLocationFromString will be ignored, using {}", flags,
locationFlags);
+        if (flags != null && !flags.isEmpty()) {
+            log.info("Flags {} passed to SingleMachineProvisioningLocation.obtain will be
ignored, using {}", Sanitizer.sanitize(flags), Sanitizer.sanitize(locationFlags));
+        }
         return obtain();
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/70ed0e1e/core/src/main/java/org/apache/brooklyn/util/core/task/BasicExecutionManager.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/util/core/task/BasicExecutionManager.java
b/core/src/main/java/org/apache/brooklyn/util/core/task/BasicExecutionManager.java
index 02277a1..d90b1a1 100644
--- a/core/src/main/java/org/apache/brooklyn/util/core/task/BasicExecutionManager.java
+++ b/core/src/main/java/org/apache/brooklyn/util/core/task/BasicExecutionManager.java
@@ -50,6 +50,7 @@ import org.apache.brooklyn.api.mgmt.HasTaskChildren;
 import org.apache.brooklyn.api.mgmt.Task;
 import org.apache.brooklyn.api.mgmt.TaskAdaptable;
 import org.apache.brooklyn.core.BrooklynFeatureEnablement;
+import org.apache.brooklyn.core.config.Sanitizer;
 import org.apache.brooklyn.util.collections.MutableList;
 import org.apache.brooklyn.util.exceptions.Exceptions;
 import org.apache.brooklyn.util.text.Identifiers;
@@ -571,7 +572,7 @@ public class BasicExecutionManager implements ExecutionManager {
     @SuppressWarnings("unchecked")
     protected <T> Task<T> submitNewTask(final Map<?,?> flags, final Task<T>
task) {
         if (log.isTraceEnabled()) log.trace("Submitting task {} ({}), with flags {}, and
tags {}, job {}", 
-                new Object[] {task.getId(), task, flags, task.getTags(), 
+                new Object[] {task.getId(), task, Sanitizer.sanitize(flags), task.getTags(),

                 (task instanceof TaskInternal ? ((TaskInternal<T>)task).getJob() :
"<unavailable>")});
         
         if (task instanceof ScheduledTask)

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/70ed0e1e/core/src/main/java/org/apache/brooklyn/util/core/task/system/internal/SystemProcessTaskFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/util/core/task/system/internal/SystemProcessTaskFactory.java
b/core/src/main/java/org/apache/brooklyn/util/core/task/system/internal/SystemProcessTaskFactory.java
index ab87480..20e6180 100644
--- a/core/src/main/java/org/apache/brooklyn/util/core/task/system/internal/SystemProcessTaskFactory.java
+++ b/core/src/main/java/org/apache/brooklyn/util/core/task/system/internal/SystemProcessTaskFactory.java
@@ -22,6 +22,7 @@ import java.io.File;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.apache.brooklyn.core.config.Sanitizer;
 import org.apache.brooklyn.location.ssh.SshMachineLocation;
 import org.apache.brooklyn.util.collections.MutableMap;
 import org.apache.brooklyn.util.core.config.ConfigBag;
@@ -104,7 +105,7 @@ public class SystemProcessTaskFactory<T extends SystemProcessTaskFactory<T,RET>,
             protected <U> U execWithTool(MutableMap<String, Object> props, Function<ShellTool,
U> task) {
                 // properties typically passed to both
                 if (log.isDebugEnabled() && props!=null && !props.isEmpty())
-                    log.debug("Ignoring flags "+props+" when running "+this);
+                    log.debug("Ignoring flags "+Sanitizer.sanitize(props)+" when running
"+this);
                 return task.apply(new ProcessTool());
             }
             @Override


Mime
View raw message