ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject git commit: AMBARI-4422. More UI install/start log cleanup (aonishuk)
Date Wed, 29 Jan 2014 13:31:40 GMT
Updated Branches:
  refs/heads/trunk c6e65f534 -> 17da19222


AMBARI-4422. More UI install/start log cleanup (aonishuk)


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

Branch: refs/heads/trunk
Commit: 17da19222b39422a3330ccebf9da727f2c318a27
Parents: c6e65f5
Author: Andrew Onischuk <aonishuk@hortonworks.com>
Authored: Wed Jan 29 05:27:28 2014 -0800
Committer: Andrew Onischuk <aonishuk@hortonworks.com>
Committed: Wed Jan 29 05:27:28 2014 -0800

----------------------------------------------------------------------
 .../resource_management/core/environment.py     | 27 +++++++++++++++++++-
 .../libraries/functions/default.py              |  2 +-
 2 files changed, 27 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/17da1922/ambari-agent/src/main/python/resource_management/core/environment.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/core/environment.py b/ambari-agent/src/main/python/resource_management/core/environment.py
index e0e0aaa..931b223 100644
--- a/ambari-agent/src/main/python/resource_management/core/environment.py
+++ b/ambari-agent/src/main/python/resource_management/core/environment.py
@@ -125,12 +125,37 @@ class Environment(object):
 
     raise Exception("Unknown condition type %r" % cond)
 
+  def _get_resource_repr(self, resource):
+    arguments_str = ""
+    for x,y in resource.arguments.iteritems():
+      
+      # strip unicode 'u' sign
+      if isinstance(y, unicode):
+        val = repr(y).lstrip('u')
+      # don't show dicts of configurations
+      # usually too long  
+      elif isinstance(y, dict):
+        val = "..."
+      # correctly output 'mode' (as they are octal values like 0755)
+      elif y and x == 'mode':
+        val = oct(y)
+      else:
+        val = repr(y)
+      
+      
+      arguments_str += "'{0}': {1}, ".format(x, val)
+      
+    if arguments_str:  
+      arguments_str = arguments_str[:-2]
+    
+    return "{0} {{{1}}}".format(resource, arguments_str)  
+    
   def run(self):
     with self:
       # Run resource actions
       while self.resource_list:
         resource = self.resource_list.pop(0)
-        self.log.info("%s %s" % (resource, repr(resource.arguments).replace("': u'","': '")))
+        self.log.info(self._get_resource_repr(resource))
         
         if resource.initial_wait:
           time.sleep(resource.initial_wait)

http://git-wip-us.apache.org/repos/asf/ambari/blob/17da1922/ambari-agent/src/main/python/resource_management/libraries/functions/default.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/libraries/functions/default.py
b/ambari-agent/src/main/python/resource_management/libraries/functions/default.py
index 1520e00..a66b9cd 100644
--- a/ambari-agent/src/main/python/resource_management/libraries/functions/default.py
+++ b/ambari-agent/src/main/python/resource_management/libraries/functions/default.py
@@ -40,7 +40,7 @@ def default(name, default_value):
       curr_dict = curr_dict[x]
     else:
       if not isinstance(default_value, UnknownConfiguration):
-        log.info("Cannot find configuration: '%s'. Using '%s' value as default" % (name,
default_value))
+        log.debug("Cannot find configuration: '%s'. Using '%s' value as default" % (name,
default_value))
       return default_value
 
   return curr_dict
\ No newline at end of file


Mime
View raw message