You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vb...@apache.org on 2015/09/09 15:01:51 UTC

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)

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 <vb...@hortonworks.com>
Authored: Wed Sep 9 15:59:41 2015 +0300
Committer: Vitaly Brodetskyi <vb...@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