You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dd...@apache.org on 2011/12/15 01:04:15 UTC
svn commit: r1214570 - in /incubator/ambari/trunk/agent/src:
main/python/ambari_agent/ActionQueue.py test/python/TestAgentActions.py
Author: ddas
Date: Thu Dec 15 00:04:15 2011
New Revision: 1214570
URL: http://svn.apache.org/viewvc?rev=1214570&view=rev
Log:
AMBARI-157. Continuing the commits.
Modified:
incubator/ambari/trunk/agent/src/main/python/ambari_agent/ActionQueue.py
incubator/ambari/trunk/agent/src/test/python/TestAgentActions.py
Modified: incubator/ambari/trunk/agent/src/main/python/ambari_agent/ActionQueue.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/main/python/ambari_agent/ActionQueue.py?rev=1214570&r1=1214569&r2=1214570&view=diff
==============================================================================
--- incubator/ambari/trunk/agent/src/main/python/ambari_agent/ActionQueue.py (original)
+++ incubator/ambari/trunk/agent/src/main/python/ambari_agent/ActionQueue.py Thu Dec 15 00:04:15 2011
@@ -158,6 +158,7 @@ class ActionQueue(threading.Thread):
# Install and configure action
def installAndConfigAction(self, action):
global installScriptHash
+ r=self.genResult(action)
w = self.writeFileAction(action,self.getInstallFilename(action['id']))
commandResult = {}
if w['exitCode']!=0:
@@ -184,14 +185,11 @@ class ActionQueue(threading.Thread):
logger.debug(arr)
action['command'] = arr
logger.debug(action['command'])
- r = self.sh.run(action['command'])
- logger.debug("PUPPET COMMAND OUTPUT: " + r['output'])
- logger.debug("PUPPET COMMAND ERROR: " + r['error'])
- if r['exitCode'] != 0:
- commandResult['error'] = r['error']
- else:
+ commandResult = self.sh.run(action['command'])
+ logger.debug("PUPPET COMMAND OUTPUT: " + commandResult['output'])
+ logger.debug("PUPPET COMMAND ERROR: " + commandResult['error'])
+ if commandResult['exitCode'] == 0:
installScriptHash = action['id']
- commandResult['exitCode'] = r['exitCode']
r['commandResult'] = commandResult
return r
@@ -219,7 +217,7 @@ class ActionQueue(threading.Thread):
return deleteStructure(action, result)
def noOpAction(self, action):
- r = {'exitCode' : 0 }
+ r = {'id' : action['id']}
return r
# Handle unknown action
Modified: incubator/ambari/trunk/agent/src/test/python/TestAgentActions.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/test/python/TestAgentActions.py?rev=1214570&r1=1214569&r2=1214570&view=diff
==============================================================================
--- incubator/ambari/trunk/agent/src/test/python/TestAgentActions.py (original)
+++ incubator/ambari/trunk/agent/src/test/python/TestAgentActions.py Thu Dec 15 00:04:15 2011
@@ -54,5 +54,6 @@ class TestAgentActions(TestCase):
result = { }
actionQueue = ActionQueue(AmbariConfig().getConfig())
result = actionQueue.installAndConfigAction(action)
- self.assertEqual(result['exitCode'], 0, "installAndConfigAction test failed. Returned %d " % result['exitCode'])
- self.assertEqual(result['output'], path + "\n", "installAndConfigAction test failed Returned %s " % result['output'])
+ cmdResult = result['commandResult']
+ self.assertEqual(cmdResult['exitCode'], 0, "installAndConfigAction test failed. Returned %d " % cmdResult['exitCode'])
+ self.assertEqual(cmdResult['output'], path + "\n", "installAndConfigAction test failed Returned %s " % cmdResult['output'])