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 16:10:08 UTC

git commit: AMBARI-4103 Structured command output may contain exception data in some cases (dsen)

Updated Branches:
  refs/heads/trunk 2e04d3b02 -> dcadbc9ef


AMBARI-4103 Structured command output may contain exception data in some cases (dsen)


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

Branch: refs/heads/trunk
Commit: dcadbc9ef9c5dc295d025949ebd185ec7eac8ad3
Parents: 2e04d3b
Author: Dmitry Sen <ds...@hortonworks.com>
Authored: Wed Dec 18 17:07:52 2013 +0200
Committer: Dmitry Sen <ds...@hortonworks.com>
Committed: Wed Dec 18 17:08:25 2013 +0200

----------------------------------------------------------------------
 .../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    | 4 ++++
 4 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/dcadbc9e/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 21032fa..ee51465 100644
--- a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
+++ b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
@@ -143,7 +143,7 @@ class CustomServiceOrchestrator():
       ret = {
         'stdout' : message,
         'stderr' : message,
-        'structuredOut' : message,
+        'structuredOut' : {},
         'exitcode': 1,
       }
     return ret

http://git-wip-us.apache.org/repos/asf/ambari/blob/dcadbc9e/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 ddfb6a8..1bfaed2 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/dcadbc9e/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 b0aa565..1a0cea9 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/dcadbc9e/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 3568f61..e1c0ca0 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
@@ -183,6 +183,10 @@ class TestCustomServiceOrchestrator(TestCase):
     self.assertEqual(ret['exitcode'], 1)
     self.assertFalse(run_file_mock.called)
     self.assertTrue("Unknown script type" in ret['stdout'])
+
+    #By default returns empty dictionary
+    self.assertEqual(ret['structuredOut'], {})
+
     pass
 
   @patch.object(CustomServiceOrchestrator, "dump_command_to_json")