ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vbrodets...@apache.org
Subject ambari git commit: AMBARI-13034. If for some reason, structured-out-status.json is empty then ambari-server will fail to report any status.(vbrodetskyi)
Date Wed, 09 Sep 2015 13:01:51 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 7716a8eb0 -> 09633340e


AMBARI-13034. If for some reason, structured-out-status.json is empty then ambari-server will
fail to report any status.(vbrodetskyi)


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

Branch: refs/heads/trunk
Commit: 09633340e176f5e6988e404a6723159f9db02ad9
Parents: 7716a8e
Author: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Authored: Wed Sep 9 15:59:41 2015 +0300
Committer: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Committed: Wed Sep 9 16:00:30 2015 +0300

----------------------------------------------------------------------
 .../libraries/script/script.py                   | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/09633340/ambari-common/src/main/python/resource_management/libraries/script/script.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/script/script.py
b/ambari-common/src/main/python/resource_management/libraries/script/script.py
index 85386db..2155fdb 100644
--- a/ambari-common/src/main/python/resource_management/libraries/script/script.py
+++ b/ambari-common/src/main/python/resource_management/libraries/script/script.py
@@ -111,15 +111,16 @@ class Script(object):
   def load_structured_out(self):
     Script.structuredOut = {}
     if os.path.exists(self.stroutfile):
-      with open(self.stroutfile, 'r') as fp:
-        try:
-          Script.structuredOut = json.load(fp)
-        except Exception:
-          errMsg = 'Unable to read structured output from ' + self.stroutfile
-          self.logger.warn(errMsg)
-          pass
-
-    # version is only set in a specific way and should not be carried 
+      if os.path.getsize(self.stroutfile) > 0:
+        with open(self.stroutfile, 'r') as fp:
+          try:
+            Script.structuredOut = json.load(fp)
+          except Exception:
+            errMsg = 'Unable to read structured output from ' + self.stroutfile
+            self.logger.warn(errMsg)
+            pass
+
+    # version is only set in a specific way and should not be carried
     if "version" in Script.structuredOut:
       del Script.structuredOut["version"]
     # reset security issues and errors found on previous runs


Mime
View raw message