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/13 23:49:13 UTC
svn commit: r1213968 - in
/incubator/ambari/trunk/agent/src/main/python/ambari_agent: ActionQueue.py
AmbariConfig.py
Author: ddas
Date: Tue Dec 13 22:49:13 2011
New Revision: 1213968
URL: http://svn.apache.org/viewvc?rev=1213968&view=rev
Log:
AMBARI-157. Fixed some bugs.
Modified:
incubator/ambari/trunk/agent/src/main/python/ambari_agent/ActionQueue.py
incubator/ambari/trunk/agent/src/main/python/ambari_agent/AmbariConfig.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=1213968&r1=1213967&r2=1213968&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 Tue Dec 13 22:49:13 2011
@@ -19,9 +19,11 @@ limitations under the License.
'''
import logging
+import traceback
import logging.handlers
import Queue
import threading
+import AmbariConfig
from shell import shellRunner
from FileUtil import writeFile, createStructure, deleteStructure, getFilePath, appendToFile
from shell import shellRunner
@@ -96,10 +98,9 @@ class ActionQueue(threading.Thread):
'NO_OP_ACTION' : self.noOpAction
}
try:
- print("ACTION KIND")
- print(action['kind'])
result = switches.get(action['kind'], self.unknownAction)(action)
except Exception, err:
+ traceback.print_exc()
logger.info(err)
result = self.genResult(action)
result['exitCode']=1
@@ -163,24 +164,27 @@ class ActionQueue(threading.Thread):
commandResult['exitCode'] = w['exitCode']
r['commandResult'] = commandResult
return r
- logger.info("Command to run ")
if 'command' not in action:
# this is hardcoded to do puppet specific stuff for now
# append the content of the puppet file to the file written above
filepath = getFilePath(action,self.getInstallFilename(action['id']))
+ logger.debug("FILEPATH : " + filepath)
p = self.sh.run(['/bin/cat',AmbariConfig.config.get('puppet','driver')])
if p['exitCode']!=0:
commandResult['error'] = p['error']
commandResult['exitCode'] = p['exitCode']
r['commandResult'] = commandResult
return r
- print("The contents of the static file " + p['output'])
+ logger.debug("The contents of the static file " + p['output'])
appendToFile(p['output'],filepath)
- action['command']=[AmbariConfig.config.get('puppet','commandpath'), filepath]
- print ("PUPPET COMMAND : " + action['command'])
- logger.info(action['command'])
+ arr = [AmbariConfig.config.get('puppet','commandpath') , filepath]
+ 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:
Modified: incubator/ambari/trunk/agent/src/main/python/ambari_agent/AmbariConfig.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/main/python/ambari_agent/AmbariConfig.py?rev=1213968&r1=1213967&r2=1213968&view=diff
==============================================================================
--- incubator/ambari/trunk/agent/src/main/python/ambari_agent/AmbariConfig.py (original)
+++ incubator/ambari/trunk/agent/src/main/python/ambari_agent/AmbariConfig.py Tue Dec 13 22:49:13 2011
@@ -35,7 +35,7 @@ prefix=/tmp/ambari
[puppet]
prefix=/homes/ddas/puppet
-commandpath='/usr/local/bin/puppet apply --modulepath /home/puppet/puppet-ambari/modules'
+commandpath=/usr/local/bin/puppet apply --modulepath /home/puppet/puppet-ambari/modules
driver=/home/puppet/puppet-ambari/manifests/site.pp
"""