You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sw...@apache.org on 2013/03/16 04:39:05 UTC

svn commit: r1457194 [1/2] - in /incubator/ambari/trunk: ./ ambari-agent/ ambari-agent/src/main/python/ambari_agent/ ambari-agent/src/main/upgrade_scripts/ ambari-agent/src/main/upgrade_stack/ ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/ ambari...

Author: swagle
Date: Sat Mar 16 03:39:02 2013
New Revision: 1457194

URL: http://svn.apache.org/r1457194
Log:
AMBARI-1647. Integrate server and agent changes for upgrade on cluster. (Sumit Mohanty via swagle)

Added:
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/DATANODE/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/DATANODE/upgrade.d/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/DATANODE/upgrade.d/50-dummy.pp
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/GANGLIA_MONITOR/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/GANGLIA_MONITOR/stub.txt
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/GANGLIA_SERVER/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/GANGLIA_SERVER/stub.txt
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HADOOP_CLIENT/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HADOOP_CLIENT/stub.txt
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HBASE_CLIENT/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HBASE_CLIENT/stub.txt
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HBASE_MASTER/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HBASE_MASTER/stub.txt
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HBASE_REGIONSERVER/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HBASE_REGIONSERVER/stub.txt
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HCAT/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HCAT/stub.txt
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HDFS_CLIENT/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HDFS_CLIENT/upgrade.d/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HDFS_CLIENT/upgrade.d/50-dummy.pp
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HIVE_CLIENT/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HIVE_CLIENT/stub.txt
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HIVE_METASTORE/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HIVE_METASTORE/stub.txt
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HIVE_SERVER/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HIVE_SERVER/stub.txt
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HUE_SERVER/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HUE_SERVER/stub.txt
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/JOBTRACKER/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/JOBTRACKER/upgrade.d/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/JOBTRACKER/upgrade.d/50-dummy.pp
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/MAPREDUCE_CLIENT/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/MAPREDUCE_CLIENT/upgrade.d/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/MAPREDUCE_CLIENT/upgrade.d/50-dummy.pp
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/MONITOR_WEBSERVER/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/MONITOR_WEBSERVER/stub.txt
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/MYSQL_SERVER/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/MYSQL_SERVER/stub.txt
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/NAGIOS_SERVER/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/NAGIOS_SERVER/stub.txt
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/NAMENODE/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/NAMENODE/upgrade.d/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/NAMENODE/upgrade.d/50-dummy.pp
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/OOZIE_CLIENT/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/OOZIE_CLIENT/stub.txt
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/OOZIE_SERVER/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/OOZIE_SERVER/stub.txt
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/PIG/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/PIG/stub.txt
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/SECONDARY_NAMENODE/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/SECONDARY_NAMENODE/upgrade.d/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/SECONDARY_NAMENODE/upgrade.d/50-dummy.pp
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/SQOOP/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/SQOOP/stub.txt
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/TASKTRACKER/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/TASKTRACKER/upgrade.d/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/TASKTRACKER/upgrade.d/50-dummy.pp
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/WEBHCAT_SERVER/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/WEBHCAT_SERVER/stub.txt
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/ZOOKEEPER_CLIENT/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/ZOOKEEPER_CLIENT/stub.txt
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/ZOOKEEPER_SERVER/
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/ZOOKEEPER_SERVER/stub.txt
    incubator/ambari/trunk/ambari-agent/src/test/python/TestPythonExecutor.py
    incubator/ambari/trunk/ambari-agent/src/test/python/examples/ControllerTester.py
Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-agent/pom.xml
    incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
    incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/PuppetExecutor.py
    incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py
    incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/StackVersionsFileHandler.py
    incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/UpgradeExecutor.py
    incubator/ambari/trunk/ambari-agent/src/main/upgrade_scripts/stub
    incubator/ambari/trunk/ambari-agent/src/test/python/TestActionQueue.py
    incubator/ambari/trunk/ambari-agent/src/test/python/TestLiveStatus.py
    incubator/ambari/trunk/ambari-agent/src/test/python/TestPuppetExecutor.py
    incubator/ambari/trunk/ambari-agent/src/test/python/TestStackVersionsFileHandler.py
    incubator/ambari/trunk/ambari-agent/src/test/python/TestUpgradeExecutor.py
    incubator/ambari/trunk/ambari-agent/src/test/python/dummy_files/dummy_current_stack
    incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
    incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
    incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
    incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
    incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
    incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1457194&r1=1457193&r2=1457194&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Sat Mar 16 03:39:02 2013
@@ -12,6 +12,9 @@ Trunk (unreleased changes):
 
  NEW FEATURES
 
+ AMBARI-1647. Integrate server and agent changes for upgrade on cluster. 
+ (Sumit Mohanty via swagle)
+
  AMBARI-1626. API support to upgrade host component. (Sumit Mohanty via swagle)
 
  AMBARI-1601. Server level action support. (Sumit Mohanty via swagle)

Modified: incubator/ambari/trunk/ambari-agent/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/pom.xml?rev=1457194&r1=1457193&r2=1457194&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/pom.xml (original)
+++ incubator/ambari/trunk/ambari-agent/pom.xml Sat Mar 16 03:39:02 2013
@@ -204,13 +204,13 @@
               </sources>
             </mapping>
             <mapping>
-              <directory>/var/lib/${project.artifactId}/upgrade_scripts</directory>
+              <directory>/var/lib/${project.artifactId}/upgrade_stack</directory>
               <filemode>755</filemode>
               <username>root</username>
               <groupname>root</groupname>
               <sources>
                 <source>
-                  <location>src/main/upgrade_scripts</location>
+                  <location>src/main/upgrade_stack</location>
                 </source>
               </sources>
             </mapping>

Modified: incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/ActionQueue.py?rev=1457194&r1=1457193&r2=1457194&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/ActionQueue.py (original)
+++ incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/ActionQueue.py Sat Mar 16 03:39:02 2013
@@ -67,9 +67,10 @@ class ActionQueue(threading.Thread):
                                    config.get('puppet', 'puppet_home'),
                                    config.get('puppet', 'facter_home'),
                                    config.get('agent', 'prefix'), config)
-    self.pythonExecutor = PythonExecutor.PythonExecutor()
+    self.pythonExecutor = PythonExecutor.PythonExecutor(
+                                   config.get('agent', 'prefix'), config)
     self.upgradeExecutor = UpgradeExecutor.UpgradeExecutor(self.pythonExecutor,
-                                   PuppetExecutor, config)
+                                   self.puppetExecutor, config)
     self.tmpdir = config.get('agent', 'prefix')
     self.commandInProgress = None
 

Modified: incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/PuppetExecutor.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/PuppetExecutor.py?rev=1457194&r1=1457193&r2=1457194&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/PuppetExecutor.py (original)
+++ incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/PuppetExecutor.py Sat Mar 16 03:39:02 2013
@@ -115,7 +115,7 @@ class PuppetExecutor:
     if command.has_key("taskId"):
       taskId = command['taskId']
     #Install repos
-    self.deployRepos(command, self.tmpDir, self.modulesdir, command.taskId)
+    self.deployRepos(command, self.tmpDir, self.modulesdir, taskId)
     puppetEnv = os.environ
     self.runPuppetFile(file, result, puppetEnv, tmpout, tmperr)
     if self.isSuccessfull(result["exitcode"]):

Modified: incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py?rev=1457194&r1=1457193&r2=1457194&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py (original)
+++ incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py Sat Mar 16 03:39:02 2013
@@ -30,14 +30,83 @@ logger = logging.getLogger()
 
 class PythonExecutor:
 
-  def __init__(self):
+  # How many seconds will pass before running puppet is terminated on timeout
+  PYTHON_TIMEOUT_SECONDS = 600
+
+  NO_ERROR = "none"
+  grep = Grep()
+  event = threading.Event()
+  python_process_has_been_killed = False
+
+  def __init__(self, tmpDir, config):
+    self.tmpDir = tmpDir
+    self.config = config
     pass
 
-  def run_file(self, name, stdout, stderr):
+  def run_file(self, command, file, tmpoutfile, tmperrfile):
+    """
+    Executes the specified python file in a separate subprocess.
+    Method returns only when the subprocess is finished.
+    """
+    tmpout =  open(tmpoutfile, 'w')
+    tmperr =  open(tmperrfile, 'w')
+    pythonCommand = self.pythonCommand(file)
+    logger.info("Running command " + pprint.pformat(pythonCommand))
+    process = self.lauch_python_subprocess(pythonCommand, tmpout, tmperr)
+    logger.info("Launching watchdog thread")
+    self.event.clear()
+    self.python_process_has_been_killed = False
+    thread = Thread(target =  self.python_watchdog_func, args = (process, ))
+    thread.start()
+    # Waiting for process to finished or killed
+    process.communicate()
+    self.event.set()
+    thread.join()
+    # Building results
+    error = self.NO_ERROR
+    returncode = process.returncode
+    out = open(tmpoutfile, 'r').read()
+    error = open(tmperrfile, 'r').read()
+    if self.python_process_has_been_killed:
+      error = str(error) + "\n Puppet has been killed due to timeout"
+      returncode = 999
+    result = self.condenseOutput(out, error, returncode)
+    logger.info("Result: %s" % result)
+    return result
+
+
+  def lauch_python_subprocess(self, command, tmpout, tmperr):
     """
-    Executes the file specified in a separate subprocess.
-    Method returns only when the subprocess is finished or timeout is exceeded
+    Creates subprocess with given parameters. This functionality was moved to separate method
+    to make possible unit testing
     """
-    # TODO: implement
-    logger.warn("TODO: Python file execution is not supported yet")
+    return subprocess.Popen(command,
+      stdout=tmpout,
+      stderr=tmperr)
+
+  def isSuccessfull(self, returncode):
+    return not self.python_process_has_been_killed and returncode == 0
+
+  def pythonCommand(self, file):
+    puppetcommand = ['python', file]
+    return puppetcommand
+
+  def condenseOutput(self, stdout, stderr, retcode):
+    grep = self.grep
+    result = {
+      "exitcode": retcode,
+      "stdout"  : grep.tail(stdout, grep.OUTPUT_LAST_LINES),
+      "stderr"  : grep.tail(stderr, grep.OUTPUT_LAST_LINES)
+    }
+    return result
+
+  def python_watchdog_func(self, python):
+    self.event.wait(self.PYTHON_TIMEOUT_SECONDS)
+    if python.returncode is None:
+      logger.error("Subprocess timed out and will be killed")
+      self.runShellKillPgrp(python)
+      self.python_process_has_been_killed = True
     pass
+
+  def runShellKillPgrp(self, python):
+    shell.killprocessgrp(python.pid)
\ No newline at end of file

Modified: incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/StackVersionsFileHandler.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/StackVersionsFileHandler.py?rev=1457194&r1=1457193&r2=1457194&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/StackVersionsFileHandler.py (original)
+++ incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/StackVersionsFileHandler.py Sat Mar 16 03:39:02 2013
@@ -80,7 +80,7 @@ class StackVersionsFileHandler:
       logger.info("Writing new stack versions file")
       with open (self.versionsFilePath, 'w') as f:
         for key in values:
-          f.write ("%s\t%s\n" % (key, values))
+          f.write ("%s\t%s\n" % (key, values[key]))
 
     except Exception, err:
       logger.error("Can't write new stack version (%s %s) :%s " % (component,

Modified: incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/UpgradeExecutor.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/UpgradeExecutor.py?rev=1457194&r1=1457193&r2=1457194&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/UpgradeExecutor.py (original)
+++ incubator/ambari/trunk/ambari-agent/src/main/python/ambari_agent/UpgradeExecutor.py Sat Mar 16 03:39:02 2013
@@ -30,7 +30,7 @@ import shell
 import traceback
 from Grep import Grep
 from StackVersionsFileHandler import StackVersionsFileHandler
-import re
+import re, json
 
 logger = logging.getLogger()
 grep = Grep()
@@ -61,10 +61,10 @@ class UpgradeExecutor:
     params = command['commandParams']
     srcStack = params['source_stack_version']
     tgtStack = params['target_stack_version']
-    component = command['component']
+    component = command['role']
 
     srcStackTuple = self.split_stack_version(srcStack)
-    tgtStackTuple = self.split_stack_version(srcStack)
+    tgtStackTuple = self.split_stack_version(tgtStack)
 
     if srcStackTuple is None or tgtStackTuple is None:
       errorstr = "Source (%s) or target (%s) version does not match pattern \
@@ -81,7 +81,8 @@ class UpgradeExecutor:
       # Check stack version (do we need upgrade?)
       basedir = os.path.join(self.stacksDir, upgradeId, component)
       if not os.path.isdir(basedir):
-        errorstr = "Upgrade %s is not supported" % upgradeId
+        errorstr = "Upgrade %s is not supported (dir %s does not exist)" \
+                   % (upgradeId, basedir)
         logger.error(errorstr)
         result = {
           'exitcode' : 1,
@@ -138,10 +139,12 @@ class UpgradeExecutor:
 
 
   def split_stack_version(self, verstr):
-    matchObj = re.match( r'^(.*)-(\d+).(\d+)', verstr.strip(), re.M|re.I)
-    stack_name = matchObj.group(1)
-    stack_major_ver = matchObj.group(2)
-    stack_minor_ver = matchObj.group(3)
+    verdict = json.loads(verstr)
+    stack_name = verdict["stackName"].strip()
+
+    matchObj = re.match( r'(\d+).(\d+)', verdict["stackVersion"].strip(), re.M|re.I)
+    stack_major_ver = matchObj.group(1)
+    stack_minor_ver = matchObj.group(2)
     if matchObj:
       return stack_name, stack_major_ver, stack_minor_ver
     else:
@@ -156,8 +159,14 @@ class UpgradeExecutor:
     dirpath = os.path.join(basedir, dir)
     logger.info("Executing %s" % dirpath)
     if not os.path.isdir(dirpath):
-      logger.warn("Script directory %s does not exist, skipping")
-      return
+      warnstr = "Script directory %s does not exist, skipping" % dirpath
+      logger.warn(warnstr)
+      result = {
+        'exitcode' : 0,
+        'stdout'   : warnstr,
+        'stderr'   : 'None'
+      }
+      return result
     fileList=os.listdir(dirpath)
     fileList.sort(key = self.get_key_func)
     formattedResult = {
@@ -172,11 +181,11 @@ class UpgradeExecutor:
       filepath = os.path.join(dirpath, filename)
       if filename.endswith(".pp"):
         logger.info("Running puppet file %s" % filepath)
-        result = self.puppetExecutor.just_run_one_file(command, filename,
+        result = self.puppetExecutor.just_run_one_file(command, filepath,
                                                                 tmpout, tmperr)
       elif filename.endswith(".py"):
         logger.info("Running python file %s" % filepath)
-        result = self.pythonExecutor.run_file(filepath, tmpout, tmperr)
+        result = self.pythonExecutor.run_file(command, filepath, tmpout, tmperr)
       elif filename.endswith(".pyc"):
         pass # skipping compiled files
       else:

Modified: incubator/ambari/trunk/ambari-agent/src/main/upgrade_scripts/stub
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_scripts/stub?rev=1457194&r1=1457193&r2=1457194&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_scripts/stub (original)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_scripts/stub Sat Mar 16 03:39:02 2013
@@ -18,4 +18,4 @@ See the License for the specific languag
 limitations under the License.
 '''
 
-Will be replaced with a real folder
\ No newline at end of file
+#Will be replaced with a real folder
\ No newline at end of file

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/DATANODE/upgrade.d/50-dummy.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/DATANODE/upgrade.d/50-dummy.pp?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/DATANODE/upgrade.d/50-dummy.pp (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/DATANODE/upgrade.d/50-dummy.pp Sat Mar 16 03:39:02 2013
@@ -0,0 +1,22 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+
+notify {"Dummy notification":}
\ No newline at end of file

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/GANGLIA_MONITOR/stub.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/GANGLIA_MONITOR/stub.txt?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/GANGLIA_MONITOR/stub.txt (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/GANGLIA_MONITOR/stub.txt Sat Mar 16 03:39:02 2013
@@ -0,0 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Replace the folder content with actual files required for upgrade.

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/GANGLIA_SERVER/stub.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/GANGLIA_SERVER/stub.txt?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/GANGLIA_SERVER/stub.txt (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/GANGLIA_SERVER/stub.txt Sat Mar 16 03:39:02 2013
@@ -0,0 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Replace the folder content with actual files required for upgrade.

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HADOOP_CLIENT/stub.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HADOOP_CLIENT/stub.txt?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HADOOP_CLIENT/stub.txt (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HADOOP_CLIENT/stub.txt Sat Mar 16 03:39:02 2013
@@ -0,0 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Replace the folder content with actual files required for upgrade.

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HBASE_CLIENT/stub.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HBASE_CLIENT/stub.txt?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HBASE_CLIENT/stub.txt (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HBASE_CLIENT/stub.txt Sat Mar 16 03:39:02 2013
@@ -0,0 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Replace the folder content with actual files required for upgrade.

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HBASE_MASTER/stub.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HBASE_MASTER/stub.txt?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HBASE_MASTER/stub.txt (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HBASE_MASTER/stub.txt Sat Mar 16 03:39:02 2013
@@ -0,0 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Replace the folder content with actual files required for upgrade.

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HBASE_REGIONSERVER/stub.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HBASE_REGIONSERVER/stub.txt?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HBASE_REGIONSERVER/stub.txt (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HBASE_REGIONSERVER/stub.txt Sat Mar 16 03:39:02 2013
@@ -0,0 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Replace the folder content with actual files required for upgrade.

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HCAT/stub.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HCAT/stub.txt?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HCAT/stub.txt (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HCAT/stub.txt Sat Mar 16 03:39:02 2013
@@ -0,0 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Replace the folder content with actual files required for upgrade.

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HDFS_CLIENT/upgrade.d/50-dummy.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HDFS_CLIENT/upgrade.d/50-dummy.pp?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HDFS_CLIENT/upgrade.d/50-dummy.pp (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HDFS_CLIENT/upgrade.d/50-dummy.pp Sat Mar 16 03:39:02 2013
@@ -0,0 +1,22 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+
+notify {"Dummy notification":}
\ No newline at end of file

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HIVE_CLIENT/stub.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HIVE_CLIENT/stub.txt?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HIVE_CLIENT/stub.txt (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HIVE_CLIENT/stub.txt Sat Mar 16 03:39:02 2013
@@ -0,0 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Replace the folder content with actual files required for upgrade.

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HIVE_METASTORE/stub.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HIVE_METASTORE/stub.txt?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HIVE_METASTORE/stub.txt (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HIVE_METASTORE/stub.txt Sat Mar 16 03:39:02 2013
@@ -0,0 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Replace the folder content with actual files required for upgrade.

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HIVE_SERVER/stub.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HIVE_SERVER/stub.txt?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HIVE_SERVER/stub.txt (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HIVE_SERVER/stub.txt Sat Mar 16 03:39:02 2013
@@ -0,0 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Replace the folder content with actual files required for upgrade.

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HUE_SERVER/stub.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HUE_SERVER/stub.txt?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HUE_SERVER/stub.txt (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/HUE_SERVER/stub.txt Sat Mar 16 03:39:02 2013
@@ -0,0 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Replace the folder content with actual files required for upgrade.

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/JOBTRACKER/upgrade.d/50-dummy.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/JOBTRACKER/upgrade.d/50-dummy.pp?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/JOBTRACKER/upgrade.d/50-dummy.pp (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/JOBTRACKER/upgrade.d/50-dummy.pp Sat Mar 16 03:39:02 2013
@@ -0,0 +1,22 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+
+notify {"Dummy notification":}
\ No newline at end of file

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/MAPREDUCE_CLIENT/upgrade.d/50-dummy.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/MAPREDUCE_CLIENT/upgrade.d/50-dummy.pp?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/MAPREDUCE_CLIENT/upgrade.d/50-dummy.pp (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/MAPREDUCE_CLIENT/upgrade.d/50-dummy.pp Sat Mar 16 03:39:02 2013
@@ -0,0 +1,22 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+
+notify {"Dummy notification":}
\ No newline at end of file

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/MONITOR_WEBSERVER/stub.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/MONITOR_WEBSERVER/stub.txt?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/MONITOR_WEBSERVER/stub.txt (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/MONITOR_WEBSERVER/stub.txt Sat Mar 16 03:39:02 2013
@@ -0,0 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Replace the folder content with actual files required for upgrade.

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/MYSQL_SERVER/stub.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/MYSQL_SERVER/stub.txt?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/MYSQL_SERVER/stub.txt (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/MYSQL_SERVER/stub.txt Sat Mar 16 03:39:02 2013
@@ -0,0 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Replace the folder content with actual files required for upgrade.

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/NAGIOS_SERVER/stub.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/NAGIOS_SERVER/stub.txt?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/NAGIOS_SERVER/stub.txt (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/NAGIOS_SERVER/stub.txt Sat Mar 16 03:39:02 2013
@@ -0,0 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Replace the folder content with actual files required for upgrade.

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/NAMENODE/upgrade.d/50-dummy.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/NAMENODE/upgrade.d/50-dummy.pp?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/NAMENODE/upgrade.d/50-dummy.pp (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/NAMENODE/upgrade.d/50-dummy.pp Sat Mar 16 03:39:02 2013
@@ -0,0 +1,22 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+
+notify {"Dummy notification":}
\ No newline at end of file

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/OOZIE_CLIENT/stub.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/OOZIE_CLIENT/stub.txt?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/OOZIE_CLIENT/stub.txt (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/OOZIE_CLIENT/stub.txt Sat Mar 16 03:39:02 2013
@@ -0,0 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Replace the folder content with actual files required for upgrade.

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/OOZIE_SERVER/stub.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/OOZIE_SERVER/stub.txt?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/OOZIE_SERVER/stub.txt (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/OOZIE_SERVER/stub.txt Sat Mar 16 03:39:02 2013
@@ -0,0 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Replace the folder content with actual files required for upgrade.

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/PIG/stub.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/PIG/stub.txt?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/PIG/stub.txt (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/PIG/stub.txt Sat Mar 16 03:39:02 2013
@@ -0,0 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Replace the folder content with actual files required for upgrade.

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/SECONDARY_NAMENODE/upgrade.d/50-dummy.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/SECONDARY_NAMENODE/upgrade.d/50-dummy.pp?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/SECONDARY_NAMENODE/upgrade.d/50-dummy.pp (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/SECONDARY_NAMENODE/upgrade.d/50-dummy.pp Sat Mar 16 03:39:02 2013
@@ -0,0 +1,22 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+
+notify {"Dummy notification":}
\ No newline at end of file

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/SQOOP/stub.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/SQOOP/stub.txt?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/SQOOP/stub.txt (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/SQOOP/stub.txt Sat Mar 16 03:39:02 2013
@@ -0,0 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Replace the folder content with actual files required for upgrade.

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/TASKTRACKER/upgrade.d/50-dummy.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/TASKTRACKER/upgrade.d/50-dummy.pp?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/TASKTRACKER/upgrade.d/50-dummy.pp (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/TASKTRACKER/upgrade.d/50-dummy.pp Sat Mar 16 03:39:02 2013
@@ -0,0 +1,22 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+
+notify {"Dummy notification":}
\ No newline at end of file

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/WEBHCAT_SERVER/stub.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/WEBHCAT_SERVER/stub.txt?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/WEBHCAT_SERVER/stub.txt (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/WEBHCAT_SERVER/stub.txt Sat Mar 16 03:39:02 2013
@@ -0,0 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Replace the folder content with actual files required for upgrade.

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/ZOOKEEPER_CLIENT/stub.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/ZOOKEEPER_CLIENT/stub.txt?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/ZOOKEEPER_CLIENT/stub.txt (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/ZOOKEEPER_CLIENT/stub.txt Sat Mar 16 03:39:02 2013
@@ -0,0 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Replace the folder content with actual files required for upgrade.

Added: incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/ZOOKEEPER_SERVER/stub.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/ZOOKEEPER_SERVER/stub.txt?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/ZOOKEEPER_SERVER/stub.txt (added)
+++ incubator/ambari/trunk/ambari-agent/src/main/upgrade_stack/HDP-1.2_HDP-1.3/ZOOKEEPER_SERVER/stub.txt Sat Mar 16 03:39:02 2013
@@ -0,0 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Replace the folder content with actual files required for upgrade.

Modified: incubator/ambari/trunk/ambari-agent/src/test/python/TestActionQueue.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/test/python/TestActionQueue.py?rev=1457194&r1=1457193&r2=1457194&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/test/python/TestActionQueue.py (original)
+++ incubator/ambari/trunk/ambari-agent/src/test/python/TestActionQueue.py Sat Mar 16 03:39:02 2013
@@ -203,6 +203,7 @@ class TestActionQueue(TestCase):
     queue.put(statusCommand)
     queue.run()
     returned_result = queue.resultQueue.get()
+    returned_result[1]['status'] = 'INSTALLED' # Patch live value
     self.assertEquals(returned_result, ('STATUS_COMMAND',
                                         {'clusterName': '',
                                          'componentName': 'DATANODE',

Modified: incubator/ambari/trunk/ambari-agent/src/test/python/TestLiveStatus.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/test/python/TestLiveStatus.py?rev=1457194&r1=1457193&r2=1457194&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/test/python/TestLiveStatus.py (original)
+++ incubator/ambari/trunk/ambari-agent/src/test/python/TestLiveStatus.py Sat Mar 16 03:39:02 2013
@@ -35,6 +35,6 @@ class TestLiveStatus(TestCase):
       print "LiveStatus of {0}: {1}".format(component['serviceName'], str(result))
       self.assertEquals(len(result) > 0, True, 'Livestatus should not be empty')
       if component['componentName'] == 'GANGLIA_SERVER':
-        self.assertEquals(result['stackVersion'],'HDP-1.2.2',
+        self.assertEquals(result['stackVersion'],'{"stackName":"HDP","stackVersion":"1.2.2"}',
                       'Livestatus should contain component stack version')
   

Modified: incubator/ambari/trunk/ambari-agent/src/test/python/TestPuppetExecutor.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/test/python/TestPuppetExecutor.py?rev=1457194&r1=1457193&r2=1457194&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/test/python/TestPuppetExecutor.py (original)
+++ incubator/ambari/trunk/ambari-agent/src/test/python/TestPuppetExecutor.py Sat Mar 16 03:39:02 2013
@@ -128,7 +128,6 @@ class TestPuppetExecutor(TestCase):
     time.sleep(0.1)
     subproc_mock.should_finish_event.set()
     subproc_mock.finished_event.wait()
-    print(subproc_mock.was_terminated)
     self.assertEquals(subproc_mock.was_terminated, False, "Subprocess should not be terminated before timeout")
     self.assertEquals(subproc_mock.returncode, 0, "Subprocess should not be terminated before timeout")
 

Added: incubator/ambari/trunk/ambari-agent/src/test/python/TestPythonExecutor.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/test/python/TestPythonExecutor.py?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/test/python/TestPythonExecutor.py (added)
+++ incubator/ambari/trunk/ambari-agent/src/test/python/TestPythonExecutor.py Sat Mar 16 03:39:02 2013
@@ -0,0 +1,145 @@
+#!/usr/bin/env python2.6
+
+'''
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+'''
+
+import pprint
+
+from unittest import TestCase
+import threading
+import tempfile
+import time
+from threading import Thread
+
+from PythonExecutor import PythonExecutor
+from AmbariConfig import AmbariConfig
+from mock.mock import MagicMock
+
+
+class TestPythonExecutor(TestCase):
+
+
+  def test_watchdog_1(self):
+    """
+    Tests whether watchdog works
+    """
+    subproc_mock = self.Subprocess_mockup()
+    executor = PythonExecutor("/tmp", AmbariConfig().getConfig())
+    _, tmpoutfile = tempfile.mkstemp()
+    _, tmperrfile = tempfile.mkstemp()
+    executor.PYTHON_TIMEOUT_SECONDS = 0.1
+
+    def lauch_python_subprocess_method(command, tmpout, tmperr):
+      subproc_mock.tmpout = tmpout
+      subproc_mock.tmperr = tmperr
+      return subproc_mock
+    executor.lauch_python_subprocess = lauch_python_subprocess_method
+    runShellKillPgrp_method = MagicMock()
+    runShellKillPgrp_method.side_effect = lambda python : python.terminate()
+    executor.runShellKillPgrp = runShellKillPgrp_method
+    subproc_mock.returncode = None
+    thread = Thread(target =  executor.run_file, args = ("fake_command",
+                                    "fake_puppetFile", tmpoutfile, tmperrfile))
+    thread.start()
+    time.sleep(0.1)
+    subproc_mock.finished_event.wait()
+    self.assertEquals(subproc_mock.was_terminated, True, "Subprocess should be terminated due to timeout")
+
+
+  def test_watchdog_2(self):
+    """
+    Tries to catch false positive watchdog invocations
+    """
+    subproc_mock = self.Subprocess_mockup()
+    executor = PythonExecutor("/tmp", AmbariConfig().getConfig())
+    _, tmpoutfile = tempfile.mkstemp()
+    _, tmperrfile = tempfile.mkstemp()
+    executor.PYTHON_TIMEOUT_SECONDS =  5
+
+    def lauch_python_subprocess_method(command, tmpout, tmperr):
+      subproc_mock.tmpout = tmpout
+      subproc_mock.tmperr = tmperr
+      return subproc_mock
+    executor.lauch_python_subprocess = lauch_python_subprocess_method
+    runShellKillPgrp_method = MagicMock()
+    runShellKillPgrp_method.side_effect = lambda python : python.terminate()
+    executor.runShellKillPgrp = runShellKillPgrp_method
+    subproc_mock.returncode = 0
+    thread = Thread(target =  executor.run_file, args = ("fake_command",
+                                                         "fake_puppetFile", tmpoutfile, tmperrfile))
+    thread.start()
+    time.sleep(0.1)
+    subproc_mock.should_finish_event.set()
+    subproc_mock.finished_event.wait()
+    self.assertEquals(subproc_mock.was_terminated, False, "Subprocess should not be terminated before timeout")
+    self.assertEquals(subproc_mock.returncode, 0, "Subprocess should not be terminated before timeout")
+
+
+  def test_execution_results(self):
+    subproc_mock = self.Subprocess_mockup()
+    executor = PythonExecutor("/tmp", AmbariConfig().getConfig())
+    _, tmpoutfile = tempfile.mkstemp()
+    _, tmperrfile = tempfile.mkstemp()
+    executor.PYTHON_TIMEOUT_SECONDS =  5
+
+    def lauch_python_subprocess_method(command, tmpout, tmperr):
+      subproc_mock.tmpout = tmpout
+      subproc_mock.tmperr = tmperr
+      return subproc_mock
+    executor.lauch_python_subprocess = lauch_python_subprocess_method
+    runShellKillPgrp_method = MagicMock()
+    runShellKillPgrp_method.side_effect = lambda python : python.terminate()
+    executor.runShellKillPgrp = runShellKillPgrp_method
+    subproc_mock.returncode = 0
+    subproc_mock.should_finish_event.set()
+    result = executor.run_file("command", "file", tmpoutfile, tmperrfile)
+    self.assertEquals(result, {'exitcode': 0, 'stderr': 'Dummy err', 'stdout': 'Dummy output'})
+
+
+  class Subprocess_mockup():
+    """
+    It's not trivial to use PyMock instead of class here because we need state
+    and complex logics
+    """
+
+    returncode = 0
+
+    started_event = threading.Event()
+    should_finish_event = threading.Event()
+    finished_event = threading.Event()
+    was_terminated = False
+    tmpout = None
+    tmperr = None
+    pid=-1
+
+    def communicate(self):
+      self.started_event.set()
+      self.tmpout.write("Dummy output")
+      self.tmpout.flush()
+
+      self.tmperr.write("Dummy err")
+      self.tmperr.flush()
+      self.should_finish_event.wait()
+      self.finished_event.set()
+      pass
+
+    def terminate(self):
+      self.was_terminated = True
+      self.returncode = 17
+      self.should_finish_event.set()
+

Modified: incubator/ambari/trunk/ambari-agent/src/test/python/TestStackVersionsFileHandler.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/test/python/TestStackVersionsFileHandler.py?rev=1457194&r1=1457193&r2=1457194&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/test/python/TestStackVersionsFileHandler.py (original)
+++ incubator/ambari/trunk/ambari-agent/src/test/python/TestStackVersionsFileHandler.py Sat Mar 16 03:39:02 2013
@@ -42,9 +42,9 @@ class TestStackVersionsFileHandler(TestC
   def test_read_stack_version(self, touch_method):
     stackVersionsFileHandler.versionsFilePath = dummyVersionsFile
     result = stackVersionsFileHandler.read_stack_version("NAGIOS_SERVER")
-    self.assertEquals(result, "HDP-1.2.1")
+    self.assertEquals(result, '{"stackName":"HDP","stackVersion":"1.2.1"}')
     result = stackVersionsFileHandler.read_stack_version("GANGLIA_SERVER")
-    self.assertEquals(result, "HDP-1.2.2")
+    self.assertEquals(result, '{"stackName":"HDP","stackVersion":"1.2.2"}')
     result = stackVersionsFileHandler.read_stack_version("NOTEXISTING")
     self.assertEquals(result, stackVersionsFileHandler.DEFAULT_VER)
     self.assertTrue(touch_method.called)
@@ -55,16 +55,18 @@ class TestStackVersionsFileHandler(TestC
     stackVersionsFileHandler.versionsFilePath = dummyVersionsFile
     result = stackVersionsFileHandler.read_all_stack_versions()
     self.assertEquals(len(result.keys()), 4)
-    self.assertEquals(result["NAGIOS_SERVER"], "HDP-1.2.1")
-    self.assertEquals(result["HCATALOG"], "HDP-1.3.0")
+    self.assertEquals(result["NAGIOS_SERVER"],
+          '{"stackName":"HDP","stackVersion":"1.2.1"}')
+    self.assertEquals(result["HCATALOG"],
+          '{"stackName":"HDP","stackVersion":"1.2.2"}')
     self.assertTrue(touch_method.called)
 
 
   def test_extract(self):
-    s = "   NAGIOS_SERVER	\t  HDP-1.3.0  "
+    s = '   NAGIOS_SERVER	\t  {"stackName":"HDP","stackVersion":"1.3.0"}  '
     comp, ver = stackVersionsFileHandler.extract(s)
     self.assertEqual(comp, "NAGIOS_SERVER")
-    self.assertEqual(ver, "HDP-1.3.0")
+    self.assertEqual(ver, '{"stackName":"HDP","stackVersion":"1.3.0"}')
     # testing wrong value
     s = "   NAGIOS_SERVER	"
     comp, ver = stackVersionsFileHandler.extract(s)

Modified: incubator/ambari/trunk/ambari-agent/src/test/python/TestUpgradeExecutor.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/test/python/TestUpgradeExecutor.py?rev=1457194&r1=1457193&r2=1457194&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/test/python/TestUpgradeExecutor.py (original)
+++ incubator/ambari/trunk/ambari-agent/src/test/python/TestUpgradeExecutor.py Sat Mar 16 03:39:02 2013
@@ -22,7 +22,7 @@ from unittest import TestCase
 import unittest
 import StringIO
 import socket
-import os, sys, pprint
+import os, sys, pprint, json
 from mock.mock import patch
 from mock.mock import MagicMock
 from mock.mock import create_autospec
@@ -45,10 +45,10 @@ class TestUpgradeExecutor(TestCase):
     # Checking matching versions
     command = {
       'commandParams' :	{
-        'source_stack_version' : 'HDP-1.3.0',
-        'target_stack_version' : 'HDP-1.3.0',
+        'source_stack_version' : '{\"stackName\":\"HDP\",\"stackVersion\":\"1.3.0\"}',
+        'target_stack_version' : '{\"stackName\":\"HDP\",\"stackVersion\":\"1.3.0\"}',
        },
-      'component' : 'HDFS'
+      'role' : 'HDFS'
     }
     result = executor.perform_stack_upgrade(command, 'tmpout', 'tmperr')
     self.assertTrue('matches current stack version' in result['stdout'])
@@ -57,10 +57,10 @@ class TestUpgradeExecutor(TestCase):
     write_stack_version_method.reset()
     command = {
       'commandParams' :	{
-        'source_stack_version' : 'HDP-1.0.1',
-        'target_stack_version' : 'HDP-1.3.0',
+        'source_stack_version' : '{\"stackName\":\"HDP\",\"stackVersion\":\"1.0.1\"}',
+        'target_stack_version' : '{\"stackName\":\"HDP\",\"stackVersion\":\"1.3.0\"}',
       },
-      'component' : 'HDFS'
+      'role' : 'HDFS'
     }
     isdir_method.return_value = False
     result = executor.perform_stack_upgrade(command, 'tmpout', 'tmperr')
@@ -70,10 +70,10 @@ class TestUpgradeExecutor(TestCase):
     write_stack_version_method.reset()
     command = {
       'commandParams' :	{
-        'source_stack_version' : 'HDP-1.0.1',
-        'target_stack_version' : 'HDP-1.3.0',
+        'source_stack_version' : '{\"stackName\":\"HDP\",\"stackVersion\":\"1.0.1\"}',
+        'target_stack_version' : '{\"stackName\":\"HDP\",\"stackVersion\":\"1.3.0\"}',
       },
-      'component' : 'HDFS'
+      'role' : 'HDFS'
     }
     isdir_method.return_value = True
     executor.execute_dir = lambda command, basedir, dir, tmpout, tmperr : \
@@ -91,10 +91,10 @@ class TestUpgradeExecutor(TestCase):
     write_stack_version_method.reset()
     command = {
       'commandParams' :	{
-        'source_stack_version' : 'HDP-1.0.1',
-        'target_stack_version' : 'HDP-1.3.0',
+        'source_stack_version' : '{\"stackName\":\"HDP\",\"stackVersion\":\"1.0.1\"}',
+        'target_stack_version' : '{\"stackName\":\"HDP\",\"stackVersion\":\"1.3.0\"}',
       },
-      'component' : 'HDFS'
+      'role' : 'HDFS'
     }
     isdir_method.return_value = True
     executor.execute_dir = lambda command, basedir, dir, tmpout, tmperr :\
@@ -131,11 +131,11 @@ class TestUpgradeExecutor(TestCase):
   def test_split_stack_version(self):
     executor = UpgradeExecutor.UpgradeExecutor('pythonExecutor',
              'puppetExecutor', AmbariConfig.AmbariConfig().getConfig())
-    result = executor.split_stack_version("HDP-1.2.1")
+    result = executor.split_stack_version('{\"stackName\":\"HDP\",\"stackVersion\":\"1.2.1\"}')
     self.assertEquals(result, ('HDP', '1', '2'))
-    result = executor.split_stack_version("HDP-1.3")
+    result = executor.split_stack_version('{\"stackName\":\"HDP\",\"stackVersion\":\"1.3\"}')
     self.assertEquals(result, ('HDP', '1', '3'))
-    result = executor.split_stack_version("ComplexStackVersion-1.3.4.2.2")
+    result = executor.split_stack_version('{\"stackName\":\"ComplexStackVersion\",\"stackVersion\":\"1.3.4.2.2\"}')
     self.assertEquals(result, ('ComplexStackVersion', '1', '3'))
     pass
 

Modified: incubator/ambari/trunk/ambari-agent/src/test/python/dummy_files/dummy_current_stack
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/test/python/dummy_files/dummy_current_stack?rev=1457194&r1=1457193&r2=1457194&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/test/python/dummy_files/dummy_current_stack (original)
+++ incubator/ambari/trunk/ambari-agent/src/test/python/dummy_files/dummy_current_stack Sat Mar 16 03:39:02 2013
@@ -1,4 +1,4 @@
-DATANODE    HDP-1.2.0
-NAGIOS_SERVER    HDP-1.2.1
-HCATALOG    HDP-1.3.0
-GANGLIA_SERVER  HDP-1.2.2
+DATANODE    {"stackName":"HDP","stackVersion":"1.2.0"}
+NAGIOS_SERVER   {"stackName":"HDP","stackVersion":"1.2.1"}
+HCATALOG    {"stackName":"HDP","stackVersion":"1.2.2"}
+GANGLIA_SERVER  {"stackName":"HDP","stackVersion":"1.2.2"}

Added: incubator/ambari/trunk/ambari-agent/src/test/python/examples/ControllerTester.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/test/python/examples/ControllerTester.py?rev=1457194&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/test/python/examples/ControllerTester.py (added)
+++ incubator/ambari/trunk/ambari-agent/src/test/python/examples/ControllerTester.py Sat Mar 16 03:39:02 2013
@@ -0,0 +1,222 @@
+from ambari_agent import Controller
+import pprint, json, os, time, sys
+import tempfile
+from urllib2 import Request, urlopen, URLError
+from mock.mock import patch, MagicMock, call
+from ambari_agent.AmbariConfig  import AmbariConfig
+import Queue
+import logging
+from ambari_agent import PuppetExecutor, PythonExecutor
+
+logger=logging.getLogger()
+
+queue = Queue.Queue()
+
+# Set to True to replace python and puppet calls with mockups
+disable_python_and_puppet = False
+
+# Values from the list below are returned in responce to agent requests (one per
+# request). When every value has been returned, the last element of list is
+# returned on every subsequent request.
+responces = [
+  """{"responseId":"n",
+  "response":"OK"}""",
+
+  """
+  {
+    "responseId":"n",
+    "restartAgent": "False",
+    "executionCommands":
+      [{
+        "commandId": "31-1",
+        "role" : "DATANODE",
+        "taskId" : 2,
+        "clusterName" : "clusterName",
+        "serviceName" : "HDFS",
+        "roleCommand" : "UPGRADE",
+        "hostname" : "localhost.localdomain",
+        "hostLevelParams": {},
+        "clusterHostInfo": "clusterHostInfo",
+        "configurations": {},
+        "commandType": "EXECUTION_COMMAND",
+        "configurations": {"global" : {}},
+        "roleParams": {},
+        "commandParams" :	{
+          "source_stack_version": "{\\"stackName\\":\\"HDP\\",\\"stackVersion\\":\\"1.2.2\\"}",
+          "target_stack_version": "{\\"stackName\\":\\"HDP\\",\\"stackVersion\\":\\"1.3.0\\"}"
+        },
+        "clusterHostInfo": {
+          "ambari_db_server_host": [
+              "dev.hortonworks.com"
+          ],
+          "ganglia_server_host": [
+              "dev.hortonworks.com"
+          ],
+          "nagios_server_host": [
+              "dev.hortonworks.com"
+          ],
+          "namenode_host": [
+              "dev.hortonworks.com"
+          ],
+          "slave_hosts": [
+              "dev.hortonworks.com"
+          ]
+        }
+      }],
+    "statusCommands":[]
+  }
+  """,
+
+  """
+  {
+    "responseId":"n",
+    "restartAgent": "False",
+    "executionCommands": [],
+    "statusCommands":[]
+  }
+  """
+]
+
+class Int(object):
+  def __init__(self, value):
+    self.value = value
+
+  def inc(self):
+    self.value += 1
+
+  def val(self):
+    return self.value
+
+responseId = Int(0)
+
+def main():
+
+  if disable_python_and_puppet:
+    with patch.object(PuppetExecutor.PuppetExecutor, 'just_run_one_file') \
+                                          as just_run_one_file_pp_method:
+      just_run_one_file_pp_method.side_effect = \
+              lambda command, file, tmpout, tmperr: {
+          'exitcode' : 0,
+          'stdout'   : "Simulated run of pp %s" % file,
+          'stderr'   : 'None'
+        }
+      with patch.object(PythonExecutor.PythonExecutor, 'run_file') \
+                                          as run_file_py_method:
+        run_file_py_method.side_effect = \
+              lambda command, file, tmpoutfile, tmperrfile: {
+          'exitcode' : 0,
+          'stdout'   : "Simulated run of py %s" % file,
+          'stderr'   : 'None'
+        }
+        run_simulation()
+  else:
+    run_simulation()
+
+
+
+def run_simulation():
+  Controller.logger = MagicMock()
+  sendRequest_method = MagicMock()
+
+  tmpfile = tempfile.gettempdir()
+
+  config = AmbariConfig().getConfig()
+  config.set('agent', 'prefix', tmpfile)
+
+  scriptsDir = os.path.join(os.getcwd(), os.pardir,os.pardir,
+    os.pardir, 'main', 'upgrade_stack')
+  config.set('stack', 'upgradeScriptsDir', scriptsDir)
+
+  controller = Controller.Controller(config)
+  controller.sendRequest = sendRequest_method
+  controller.netutil.HEARTBEAT_IDDLE_INTERVAL_SEC = 0.1
+  controller.netutil.HEARTBEAT_NOT_IDDLE_INTERVAL_SEC = 0.1
+  controller.range = 1
+
+
+
+  for responce in responces:
+    queue.put(responce)
+
+  def send_stub(url, data):
+    logger.info("Controller sends data to %s :" % url)
+    logger.info(pprint.pformat(data))
+    if not queue.empty():
+      responce = queue.get()
+    else:
+      responce = responces[-1]
+      logger.info("There is no predefined responce available, sleeping for 30 sec")
+      time.sleep(30)
+    responce = json.loads(responce)
+    responseId.inc()
+    responce["responseId"] = responseId.val()
+    responce = json.dumps(responce)
+    logger.info("Returning data to Controller:" + responce)
+    return responce
+
+  sendRequest_method.side_effect = send_stub
+
+  logger.setLevel(logging.DEBUG)
+  formatter = logging.Formatter("%(asctime)s %(filename)s:%(lineno)d - \
+        %(message)s")
+  stream_handler = logging.StreamHandler()
+  stream_handler.setFormatter(formatter)
+  logger.addHandler(stream_handler)
+  logger.info("Starting")
+
+  controller.start()
+  controller.actionQueue.IDLE_SLEEP_TIME = 0.1
+  controller.run()
+
+
+if __name__ == '__main__':
+#  s =   """
+#  {
+#    "responseId":"n",
+#    "restartAgent": "False",
+#    "executionCommands":
+#      [{
+#        "commandId": "31-1",
+#        "role" : "DATANODE",
+#        "taskId" : 2,
+#        "clusterName" : "clusterName",
+#        "serviceName" : "HDFS",
+#        "roleCommand" : "UPGRADE",
+#        "hostname" : "localhost.localdomain",
+#        "hostLevelParams": {},
+#        "clusterHostInfo": "clusterHostInfo",
+#        "configurations": {},
+#        "commandType": "EXECUTION_COMMAND",
+#        "configurations": {"global" : {}},
+#        "roleParams": {},
+#        "commandParams" :	{
+#          "commandParams": {"source_stack_version": "{\\"stackName\\":\\"HDP\\",\\"stackVersion\\":\\"1.2.0\\"}", "target_stack_version": "{\\"stackName\\":\\"HDP\\",\\"stackVersion\\":\\"1.2.2\\"}"}
+#        },
+#        "clusterHostInfo": {
+#          "ambari_db_server_host": [
+#              "dev.hortonworks.com"
+#          ],
+#          "ganglia_server_host": [
+#              "dev.hortonworks.com"
+#          ],
+#          "nagios_server_host": [
+#              "dev.hortonworks.com"
+#          ],
+#          "namenode_host": [
+#              "dev.hortonworks.com"
+#          ],
+#          "slave_hosts": [
+#              "dev.hortonworks.com"
+#          ]
+#        }
+#      }],
+#    "statusCommands":[]
+#  }
+#  """
+#  t = json.loads(s)
+#  pprint.pprint(t)
+
+  main()
+
+
+