You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ds...@apache.org on 2013/12/18 18:30:31 UTC

git commit: AMBARI-4103 Structured command output may contain exception data in some cases (+ sending structured out as a string)(dsen)

Updated Branches:
  refs/heads/trunk 3a84e4f93 -> 3c1c0a02e


AMBARI-4103 Structured command output may contain exception data in some cases (+ sending structured out as a string)(dsen)


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

Branch: refs/heads/trunk
Commit: 3c1c0a02e971d11557db0e6fafbcb2e9fbcde149
Parents: 3a84e4f
Author: Dmitry Sen <ds...@hortonworks.com>
Authored: Wed Dec 18 19:29:12 2013 +0200
Committer: Dmitry Sen <ds...@hortonworks.com>
Committed: Wed Dec 18 19:29:31 2013 +0200

----------------------------------------------------------------------
 ambari-agent/src/main/python/ambari_agent/CommandStatusDict.py   | 2 +-
 .../src/main/python/ambari_agent/CustomServiceOrchestrator.py    | 2 +-
 ambari-agent/src/main/python/ambari_agent/PythonExecutor.py      | 2 +-
 .../src/test/python/ambari_agent/TestCommandStatusDict.py        | 4 ++--
 .../test/python/ambari_agent/TestCustomServiceOrchestrator.py    | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3c1c0a02/ambari-agent/src/main/python/ambari_agent/CommandStatusDict.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/CommandStatusDict.py b/ambari-agent/src/main/python/ambari_agent/CommandStatusDict.py
index f9c7e25..1da6e79 100644
--- a/ambari-agent/src/main/python/ambari_agent/CommandStatusDict.py
+++ b/ambari-agent/src/main/python/ambari_agent/CommandStatusDict.py
@@ -105,7 +105,7 @@ class CommandStatusDict():
       with open(report['structuredOut'], 'r') as fp:
         tmpstructuredout = json.load(fp)
     except Exception:
-      tmpstructuredout = {}
+      tmpstructuredout = '{}'
     grep = Grep()
     output = grep.tail(tmpout, Grep.OUTPUT_LAST_LINES)
     inprogress = self.generate_report_template(command)

http://git-wip-us.apache.org/repos/asf/ambari/blob/3c1c0a02/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
index 7f56d1b..7acbefd 100644
--- a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
+++ b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
@@ -144,7 +144,7 @@ class CustomServiceOrchestrator():
       ret = {
         'stdout' : message,
         'stderr' : message,
-        'structuredOut' : {},
+        'structuredOut' : '{}',
         'exitcode': 1,
       }
     return ret

http://git-wip-us.apache.org/repos/asf/ambari/blob/3c1c0a02/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py b/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py
index 1bfaed2..c33930d 100644
--- a/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py
+++ b/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py
@@ -94,7 +94,7 @@ class PythonExecutor:
         }
         logger.warn(structured_out)
       else:
-        structured_out = {}
+        structured_out = '{}'
 
     if self.python_process_has_been_killed:
       error = str(error) + "\n Python script has been killed due to timeout"

http://git-wip-us.apache.org/repos/asf/ambari/blob/3c1c0a02/ambari-agent/src/test/python/ambari_agent/TestCommandStatusDict.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestCommandStatusDict.py b/ambari-agent/src/test/python/ambari_agent/TestCommandStatusDict.py
index 1a0cea9..77b8f1b 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestCommandStatusDict.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestCommandStatusDict.py
@@ -107,14 +107,14 @@ class TestCommandStatusDict(TestCase):
                    {'status': 'COMPLETE', 'taskId': 4},
                    {'status': 'IN_PROGRESS', 'stderr': '...',
                     'stdout': '...', 'clusterName': u'cc',
-                    'structuredOut' : {},
+                    'structuredOut' : '{}',
                     'roleCommand': u'INSTALL', 'serviceName': u'HDFS',
                     'role': u'DATANODE', 'actionId': '1-1', 'taskId': 5,
                     'exitCode': 777},
                    {'status': 'IN_PROGRESS',
                     'stderr': '...',
                     'stdout': '...',
-                    'structuredOut' : {},
+                    'structuredOut' : '{}',
                     'clusterName': u'cc',
                     'roleCommand': u'INSTALL',
                     'serviceName': u'HDFS',

http://git-wip-us.apache.org/repos/asf/ambari/blob/3c1c0a02/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py b/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
index f732950..dadc793 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
@@ -200,7 +200,7 @@ class TestCustomServiceOrchestrator(TestCase):
     self.assertTrue("Unknown script type" in ret['stdout'])
 
     #By default returns empty dictionary
-    self.assertEqual(ret['structuredOut'], {})
+    self.assertEqual(ret['structuredOut'], '{}')
 
     pass