ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alejan...@apache.org
Subject ambari git commit: AMBARI-9081. Rolling Upgrades: clients do not send information about their version on restart (alejandro)
Date Wed, 14 Jan 2015 00:24:47 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk a4c94d705 -> 89eeb6171


AMBARI-9081. Rolling Upgrades: clients do not send information about their version on restart (alejandro)


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

Branch: refs/heads/trunk
Commit: 89eeb617154f98c3bf264802b91ea568dd172c56
Parents: a4c94d7
Author: Alejandro Fernandez <afernandez@hortonworks.com>
Authored: Fri Jan 9 14:42:39 2015 -0800
Committer: Alejandro Fernandez <afernandez@hortonworks.com>
Committed: Tue Jan 13 16:24:35 2015 -0800

----------------------------------------------------------------------
 .../main/python/ambari_agent/PythonExecutor.py  | 10 +--
 .../python/resource_management/TestScript.py    | 24 +++--
 .../libraries/script/hook.py                    |  2 +-
 .../libraries/script/script.py                  | 95 +++++++++++++-------
 .../0.5.0.2.1/package/scripts/falcon_client.py  |  4 +-
 .../0.5.0.2.1/package/scripts/falcon_server.py  |  2 -
 .../1.4.0.2.0/package/scripts/flume_handler.py  |  2 -
 .../0.96.0.2.0/package/scripts/hbase_client.py  |  2 -
 .../0.96.0.2.0/package/scripts/hbase_master.py  |  2 -
 .../package/scripts/hbase_regionserver.py       |  2 -
 .../HDFS/2.1.0.2.0/package/scripts/datanode.py  |  2 -
 .../2.1.0.2.0/package/scripts/hdfs_client.py    |  5 +-
 .../2.1.0.2.0/package/scripts/journalnode.py    |  2 -
 .../HDFS/2.1.0.2.0/package/scripts/namenode.py  |  2 -
 .../HDFS/2.1.0.2.0/package/scripts/snamenode.py |  2 -
 .../0.12.0.2.0/package/scripts/hcat_client.py   |  7 +-
 .../0.12.0.2.0/package/scripts/hive_client.py   |  4 +-
 .../package/scripts/hive_metastore.py           |  2 -
 .../0.12.0.2.0/package/scripts/hive_server.py   |  2 -
 .../package/scripts/webhcat_server.py           |  2 -
 .../0.8.1.2.2/package/scripts/kafka_broker.py   |  2 -
 .../0.5.0.2.2/package/scripts/knox_gateway.py   |  2 -
 .../4.0.0.2.0/package/scripts/oozie_client.py   |  2 -
 .../4.0.0.2.0/package/scripts/oozie_server.py   |  1 -
 .../PIG/0.12.0.2.0/package/scripts/params.py    |  2 +
 .../0.12.0.2.0/package/scripts/pig_client.py    |  3 +
 .../0.60.0.2.2/package/scripts/slider_client.py |  2 -
 .../1.4.4.2.0/package/scripts/service_check.py  |  2 -
 .../1.4.4.2.0/package/scripts/sqoop_client.py   |  2 -
 .../STORM/0.9.1.2.1/package/scripts/nimbus.py   |  2 -
 .../STORM/0.9.1.2.1/package/scripts/rest_api.py |  2 -
 .../0.9.1.2.1/package/scripts/supervisor.py     |  2 -
 .../TEZ/0.4.0.2.1/package/scripts/params.py     |  2 +
 .../TEZ/0.4.0.2.1/package/scripts/tez_client.py |  3 +
 .../scripts/application_timeline_server.py      |  2 -
 .../2.1.0.2.0/package/scripts/historyserver.py  |  1 -
 .../package/scripts/mapreduce2_client.py        |  3 +
 .../2.1.0.2.0/package/scripts/nodemanager.py    |  2 -
 .../package/scripts/resourcemanager.py          |  2 -
 .../2.1.0.2.0/package/scripts/yarn_client.py    |  3 +
 .../package/scripts/zookeeper_client.py         |  2 -
 .../package/scripts/zookeeper_server.py         |  2 -
 .../2.0.6/hooks/after-INSTALL/scripts/hook.py   |  4 +-
 .../server/state/cluster/ClusterTest.java       |  1 -
 44 files changed, 116 insertions(+), 110 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py b/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py
index 76ba1c6..d3115d0 100644
--- a/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py
+++ b/ambari-agent/src/main/python/ambari_agent/PythonExecutor.py
@@ -71,15 +71,9 @@ class PythonExecutor:
     Timeout meaning: how many seconds should pass before script execution
     is forcibly terminated
     override_output_files option defines whether stdout/stderr files will be
-    recreated or appended
+    recreated or appended.
+    The structured out file, however, is preserved during multiple invocations that use the same file.
     """
-    # need to remove this file for the following case:
-    # status call 1 does not write to file; call 2 writes to file;
-    # call 3 does not write to file, so contents are still call 2's result
-    try:
-      os.unlink(tmpstructedoutfile)
-    except OSError:
-      pass # no error
 
     script_params += [tmpstructedoutfile, logger_level, tmp_dir]
     pythonCommand = self.python_command(script, script_params)

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-agent/src/test/python/resource_management/TestScript.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestScript.py b/ambari-agent/src/test/python/resource_management/TestScript.py
index bff04b4..d2e2820 100644
--- a/ambari-agent/src/test/python/resource_management/TestScript.py
+++ b/ambari-agent/src/test/python/resource_management/TestScript.py
@@ -25,6 +25,7 @@ import pprint
 from unittest import TestCase
 import threading
 import tempfile
+import shutil
 import time
 from threading import Thread
 
@@ -43,7 +44,11 @@ class TestScript(TestCase):
     out = StringIO.StringIO()
     sys.stdout = out
 
-
+    # Temporary files and directories needed as args to Script(),
+    # which must be deleted in teardown
+    self.tmp_command_file = tempfile.NamedTemporaryFile()
+    self.tmp_structured_out_file = tempfile.NamedTemporaryFile()
+    self.tmp_data_dir = tempfile.mkdtemp()
 
   @patch("resource_management.core.providers.package.PackageProvider")
   def test_install_packages(self, package_provider_mock):
@@ -67,9 +72,11 @@ class TestScript(TestCase):
       }
     }
 
+    args = [str(os.getcwd()), "INSTALL",  str(self.tmp_command_file), str(os.getcwd()), str(self.tmp_structured_out_file), "INFO",  str(self.tmp_data_dir)]
+
     # Testing config without any keys
     with Environment(".", test_mode=True) as env:
-      script = Script()
+      script = Script(args)
       Script.config = no_packages_config
       script.install_packages(env)
     resource_dump = pprint.pformat(env.resource_list)
@@ -77,7 +84,7 @@ class TestScript(TestCase):
 
     # Testing empty package list
     with Environment(".", test_mode=True) as env:
-      script = Script()
+      script = Script(args)
       Script.config = empty_config
       script.install_packages(env)
     resource_dump = pprint.pformat(env.resource_list)
@@ -85,6 +92,7 @@ class TestScript(TestCase):
 
     # Testing installing of a list of packages
     with Environment(".", test_mode=True) as env:
+      script = Script(args)
       Script.config = dummy_config
       script.install_packages("env")
     resource_dump = pprint.pformat(env.resource_list)
@@ -92,9 +100,10 @@ class TestScript(TestCase):
 
   @patch("__builtin__.open")
   def test_structured_out(self, open_mock):
-    script = Script()
-    script.stroutfile = ''
+    args = [str(os.getcwd()), "INSTALL",  str(self.tmp_command_file), str(os.getcwd()), str(self.tmp_structured_out_file), "INFO",  str(self.tmp_data_dir)]
 
+    script = Script(args)
+    script.stroutfile = ''
     self.assertEqual(Script.structuredOut, {})
 
     script.put_structured_out({"1": "1"})
@@ -110,8 +119,13 @@ class TestScript(TestCase):
     self.assertEqual(open_mock.call_count, 3)
     self.assertEqual(Script.structuredOut, {"1": "3", "2": "2"})
 
+
   def tearDown(self):
     # enable stdout
     sys.stdout = sys.__stdout__
+    try:
+      shutil.rmtree(self.tmp_data_dir)
+    except:
+      pass
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-common/src/main/python/resource_management/libraries/script/hook.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/script/hook.py b/ambari-common/src/main/python/resource_management/libraries/script/hook.py
index 5c8eafc..1379cc3 100644
--- a/ambari-common/src/main/python/resource_management/libraries/script/hook.py
+++ b/ambari-common/src/main/python/resource_management/libraries/script/hook.py
@@ -26,7 +26,7 @@ import sys
 
 class Hook(Script):
   """
-  Executes a hook for acommand for custom service. stdout and stderr are written to
+  Executes a hook for a command for custom service. stdout and stderr are written to
   tmpoutfile and to tmperrfile respectively.
   """
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-common/src/main/python/resource_management/libraries/script/script.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/script/script.py b/ambari-common/src/main/python/resource_management/libraries/script/script.py
index af02f37..a5f6c4b 100644
--- a/ambari-common/src/main/python/resource_management/libraries/script/script.py
+++ b/ambari-common/src/main/python/resource_management/libraries/script/script.py
@@ -85,14 +85,42 @@ class Script(object):
   4 path to file with structured command output (file will be created)
   """
   structuredOut = {}
-  command_data_file = ""
-  basedir = ""
-  stroutfile = ""
-  logging_level = ""
-
+  
   # Class variable
   tmp_dir = ""
+  
+  def __init__(self, argv=None):
+    """
+    Parses arguments and initializes variables and logging
+    """
+    # parse arguments
+    self.logger, self.chout, self.cherr = Logger.initialize_logger()
 
+    args = argv if argv else sys.argv
+    if len(args) < 7:
+      self.logger.error("Script expects at least 6 arguments, %d given" % len(args))
+      print USAGE.format(os.path.basename(args[0])) # print to stdout
+      sys.exit(1)
+
+    self.command_name = str.lower(args[1])
+    self.command_data_file = args[2]
+    self.basedir = args[3]
+    self.stroutfile = args[4]
+    self.load_structured_out()
+    self.logging_level = args[5]
+    Script.tmp_dir = args[6]
+
+    self.logging_level_str = logging._levelNames[self.logging_level]
+    self.chout.setLevel(self.logging_level_str)
+    self.logger.setLevel(self.logging_level_str)
+    
+  def load_structured_out(self):
+    Script.structuredOut = {}
+    if os.path.exists(self.stroutfile):
+      with open(self.stroutfile, 'r') as fp:
+        Script.structuredOut = json.load(fp)
+        self.logger.debug("Loaded structured out from file: %s" % str(self.stroutfile))
+  
   def get_stack_to_component(self):
     """
     To be overridden by subclasses.
@@ -101,12 +129,15 @@ class Script(object):
     return {}
 
   def put_structured_out(self, sout):
+    self.logger.debug("Adding content to structured out file: %s. New data: %s" % (str(self.stroutfile), str(sout)))
+    curr_content = Script.structuredOut.copy()
     Script.structuredOut.update(sout)
     try:
       with open(self.stroutfile, 'w') as fp:
         json.dump(Script.structuredOut, fp)
-    except IOError:
-      Script.structuredOut.update({"errMsg" : "Unable to write to " + self.stroutfile})
+    except IOError, err:
+      self.logger.error("Failed to write new content to structured out file: %s. Error: %s" % (str(self.stroutfile)), str(err))
+      Script.structuredOut = curr_content.copy()
 
   def save_component_version_to_structured_out(self, stack_name):
     """
@@ -127,27 +158,8 @@ class Script(object):
 
   def execute(self):
     """
-    Sets up logging;
-    Parses command parameters and executes method relevant to command type
+    Executes method relevant to command type
     """
-    logger, chout, cherr = Logger.initialize_logger()
-    
-    # parse arguments
-    if len(sys.argv) < 7:
-     logger.error("Script expects at least 6 arguments")
-     print USAGE.format(os.path.basename(sys.argv[0])) # print to stdout
-     sys.exit(1)
-
-    command_name = str.lower(sys.argv[1])
-    self.command_data_file = sys.argv[2]
-    self.basedir = sys.argv[3]
-    self.stroutfile = sys.argv[4]
-    self.logging_level = sys.argv[5]
-    Script.tmp_dir = sys.argv[6]
-
-    logging_level_str = logging._levelNames[self.logging_level]
-    chout.setLevel(logging_level_str)
-    logger.setLevel(logging_level_str)
 
     # on windows we need to reload some of env variables manually because there is no default paths for configs(like
     # /etc/something/conf on linux. When this env vars created by one of the Script execution, they can not be updated
@@ -162,23 +174,34 @@ class Script(object):
         #load passwords here(used on windows to impersonate different users)
         Script.passwords = {}
         for k, v in _PASSWORD_MAP.iteritems():
-          if get_path_form_configuration(k,Script.config) and get_path_form_configuration(v,Script.config ):
-            Script.passwords[get_path_form_configuration(k,Script.config)] = get_path_form_configuration(v,Script.config)
+          if get_path_form_configuration(k, Script.config) and get_path_form_configuration(v, Script.config):
+            Script.passwords[get_path_form_configuration(k, Script.config)] = get_path_form_configuration(v, Script.config)
 
     except IOError:
-      logger.exception("Can not read json file with command parameters: ")
+      self.logger.exception("Can not read json file with command parameters: ")
       sys.exit(1)
+
     # Run class method depending on a command type
     try:
-      method = self.choose_method_to_execute(command_name)
+      method = self.choose_method_to_execute(self.command_name)
       with Environment(self.basedir) as env:
         method(env)
+
+        # For start actions, try to advertise the component's version
+        if self.command_name == "start" or self.command_name == "install":
+          try:
+            import params
+            # This is to support older stacks
+            if hasattr(params, "stack_name"):
+              self.save_component_version_to_structured_out(params.stack_name)
+          except ImportError:
+            self.logger.error("Executing command %s could not import params" % str(self.command_name))
     except ClientComponentHasNoStatus or ComponentIsNotRunning:
       # Support of component status checks.
       # Non-zero exit code is interpreted as an INSTALLED status of a component
       sys.exit(1)
     except Fail:
-      logger.exception("Error while executing command '{0}':".format(command_name))
+      self.logger.exception("Error while executing command '{0}':".format(self.command_name))
       sys.exit(1)
 
 
@@ -333,6 +356,14 @@ class Script(object):
       if rolling_restart:
         self.post_rolling_restart(env)
 
+    try:
+      import params
+      if hasattr(params, "stack_name"):
+        self.save_component_version_to_structured_out(params.stack_name)
+    except ImportError:
+      self.logger.error("Restart command could not import params")
+
+
   def post_rolling_restart(self, env):
     """
     To be overridden by subclasses

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_client.py b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_client.py
index 5c430df..ea9f154 100644
--- a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_client.py
+++ b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_client.py
@@ -36,8 +36,6 @@ class FalconClient(Script):
     env.set_params(params)
     falcon('client', action='config')
 
-    self.save_component_version_to_structured_out(params.stack_name)
-
   def status(self, env):
     raise ClientComponentHasNoStatus()
 
@@ -51,7 +49,7 @@ class FalconClient(Script):
       return
 
     Logger.info("Executing Falcon Client Rolling Upgrade pre-restart")
-    Execute(format("hdp-select set hadoop-client {version}"))
+    Execute(format("hdp-select set falcon-client {version}"))
 
   def security_status(self, env):
     import status_params

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_server.py b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_server.py
index 6f37f50..af98a03 100644
--- a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_server.py
+++ b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_server.py
@@ -46,8 +46,6 @@ class FalconServer(Script):
 
     falcon('server', action='start')
 
-    self.save_component_version_to_structured_out(params.stack_name)
-
 
   def stop(self, env, rolling_restart=False):
     import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/flume_handler.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/flume_handler.py b/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/flume_handler.py
index 59dba8d..849fcf1 100644
--- a/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/flume_handler.py
+++ b/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/flume_handler.py
@@ -43,8 +43,6 @@ class FlumeHandler(Script):
 
     flume(action='start')
 
-    self.save_component_version_to_structured_out(params.stack_name)
-
   def stop(self, env, rolling_restart=False):
     import params
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_client.py b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_client.py
index 3f19ce4..b00a82e 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_client.py
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_client.py
@@ -46,8 +46,6 @@ class HbaseClient(Script):
     
     hbase(name='client')
 
-    self.save_component_version_to_structured_out(params.stack_name)
-
   def status(self, env):
     raise ClientComponentHasNoStatus()
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_master.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_master.py b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_master.py
index d54ecb9..c9da84a 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_master.py
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_master.py
@@ -56,8 +56,6 @@ class HbaseMaster(Script):
     hbase_service( 'master',
       action = 'start'
     )
-
-    self.save_component_version_to_structured_out(params.stack_name)
     
   def stop(self, env, rolling_restart=False):
     import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_regionserver.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_regionserver.py b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_regionserver.py
index 72b657f..443c56c 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_regionserver.py
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_regionserver.py
@@ -61,8 +61,6 @@ class HbaseRegionServer(Script):
       action = 'start'
     )
 
-    self.save_component_version_to_structured_out(params.stack_name)
-
   def stop(self, env, rolling_restart=False):
     import params
     env.set_params(params)

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/datanode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/datanode.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/datanode.py
index 50bd822..db07932 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/datanode.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/datanode.py
@@ -62,8 +62,6 @@ class DataNode(Script):
     self.configure(env)
     datanode(action="start")
 
-    self.save_component_version_to_structured_out(params.stack_name)
-
 
   def stop(self, env, rolling_restart=False):
     import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_client.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_client.py
index 59be175..fa890ad 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_client.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_client.py
@@ -26,6 +26,10 @@ from utils import service
 
 
 class HdfsClient(Script):
+
+  def get_stack_to_component(self):
+    return {"HDP": "hadoop-client"}
+
   def install(self, env):
     import params
 
@@ -55,7 +59,6 @@ class HdfsClient(Script):
   def config(self, env):
     import params
     hdfs()
-    pass
 
   def security_status(self, env):
     import status_params

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/journalnode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/journalnode.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/journalnode.py
index 6d8716f..15e0689 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/journalnode.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/journalnode.py
@@ -64,8 +64,6 @@ class JournalNode(Script):
       create_log_dir=True
     )
 
-    self.save_component_version_to_structured_out(params.stack_name)
-
   def stop(self, env, rolling_restart=False):
     import params
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
index 7b171a8..83f34bc 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
@@ -72,8 +72,6 @@ class NameNode(Script):
     self.configure(env)
     namenode(action="start", rolling_restart=rolling_restart, env=env)
 
-    self.save_component_version_to_structured_out(params.stack_name)
-
   def post_rolling_restart(self, env):
     Logger.info("Executing Rolling Upgrade post-restart")
     import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/snamenode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/snamenode.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/snamenode.py
index a625295..49249b6 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/snamenode.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/snamenode.py
@@ -49,8 +49,6 @@ class SNameNode(Script):
     self.configure(env)
     snamenode(action="start")
 
-    self.save_component_version_to_structured_out(params.stack_name)
-
   def stop(self, env, rolling_restart=False):
     import params
     env.set_params(params)

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hcat_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hcat_client.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hcat_client.py
index 5fc27f4..811cac6 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hcat_client.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hcat_client.py
@@ -23,6 +23,10 @@ from resource_management import *
 from hcat import hcat
 
 class HCatClient(Script):
+
+  def get_stack_to_component(self):
+    return {"HDP": "hadoop-client"}
+
   def install(self, env):
     import params
     self.install_packages(env, exclude_packages=params.hive_exclude_packages)
@@ -30,12 +34,9 @@ class HCatClient(Script):
 
   def configure(self, env):
     import params
-
     env.set_params(params)
-
     hcat()
 
-
   def status(self, env):
     raise ClientComponentHasNoStatus()
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_client.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_client.py
index a11a0b6..f8306da 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_client.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_client.py
@@ -24,6 +24,9 @@ from hive import hive
 
 class HiveClient(Script):
 
+  def get_stack_to_component(self):
+    return {"HDP": "hadoop-client"}
+
   def pre_rolling_restart(self, env):
     import params
     env.set_params(params)
@@ -42,7 +45,6 @@ class HiveClient(Script):
 
     hive(name='client')
 
-
   def status(self, env):
     raise ClientComponentHasNoStatus()
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py
index 568ee8e..8753133 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py
@@ -53,8 +53,6 @@ class HiveMetastore(Script):
     self.configure(env)  # FOR SECURITY
     hive_service('metastore', action = 'start')
 
-    self.save_component_version_to_structured_out(params.stack_name)
-
 
   def stop(self, env, rolling_restart = False):
     import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server.py
index 546afca..906cc24 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server.py
@@ -59,8 +59,6 @@ class HiveServer(Script):
     hive_service( 'hiveserver2', action = 'start',
       rolling_restart=rolling_restart )
 
-    self.save_component_version_to_structured_out(params.stack_name)
-
 
   def stop(self, env, rolling_restart=False):
     import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_server.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_server.py
index 878b50c..21d9c4e 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_server.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_server.py
@@ -46,8 +46,6 @@ class WebHCatServer(Script):
     self.configure(env) # FOR SECURITY
     webhcat_service(action = 'start')
 
-    self.save_component_version_to_structured_out(params.stack_name)
-
 
   def stop(self, env, rolling_restart=False):
     import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/kafka_broker.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/kafka_broker.py b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/kafka_broker.py
index ecd41c5..ce72353 100644
--- a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/kafka_broker.py
+++ b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/kafka_broker.py
@@ -52,8 +52,6 @@ class KafkaBroker(Script):
             user=params.kafka_user,
             not_if=no_op_test
     )
-    
-    self.save_component_version_to_structured_out(params.stack_name)
 
   def stop(self, env, rolling_restart=False):
     import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/knox_gateway.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/knox_gateway.py b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/knox_gateway.py
index 660a630..9332bff 100644
--- a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/knox_gateway.py
+++ b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/knox_gateway.py
@@ -58,8 +58,6 @@ class KnoxGateway(Script):
             not_if=no_op_test
     )
 
-    self.save_component_version_to_structured_out(params.stack_name)
-
   def stop(self, env):
     import params
     env.set_params(params)

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_client.py b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_client.py
index 9a3eb66..faa326a 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_client.py
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_client.py
@@ -41,8 +41,6 @@ class OozieClient(Script):
 
     oozie(is_server=False)
 
-    self.save_component_version_to_structured_out(params.stack_name)
-
   def status(self, env):
     raise ClientComponentHasNoStatus()
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_server.py b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_server.py
index a43bda5..475be96 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_server.py
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_server.py
@@ -61,7 +61,6 @@ class OozieServer(Script):
 
     oozie_service(action='start', rolling_restart=rolling_restart)
 
-    self.save_component_version_to_structured_out(params.stack_name)
     
   def stop(self, env, rolling_restart=False):
     import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/PIG/0.12.0.2.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/PIG/0.12.0.2.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/PIG/0.12.0.2.0/package/scripts/params.py
index d7bf5eb..c31ac34 100644
--- a/ambari-server/src/main/resources/common-services/PIG/0.12.0.2.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/PIG/0.12.0.2.0/package/scripts/params.py
@@ -26,6 +26,8 @@ from resource_management import *
 config = Script.get_config()
 tmp_dir = Script.get_tmp_dir()
 
+stack_name = default("/hostLevelParams/stack_name", None)
+
 stack_version_unformatted = str(config['hostLevelParams']['stack_version'])
 hdp_stack_version = format_hdp_stack_version(stack_version_unformatted)
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/PIG/0.12.0.2.0/package/scripts/pig_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/PIG/0.12.0.2.0/package/scripts/pig_client.py b/ambari-server/src/main/resources/common-services/PIG/0.12.0.2.0/package/scripts/pig_client.py
index 2dd3835..eec9304 100644
--- a/ambari-server/src/main/resources/common-services/PIG/0.12.0.2.0/package/scripts/pig_client.py
+++ b/ambari-server/src/main/resources/common-services/PIG/0.12.0.2.0/package/scripts/pig_client.py
@@ -26,6 +26,9 @@ from pig import pig
 
 class PigClient(Script):
 
+  def get_stack_to_component(self):
+    return {"HDP": "hadoop-client"}
+
   def pre_rolling_restart(self, env):
     import params
     env.set_params(params)

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/slider_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/slider_client.py b/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/slider_client.py
index 5218f49..060fc3b 100644
--- a/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/slider_client.py
+++ b/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/slider_client.py
@@ -39,8 +39,6 @@ class SliderClient(Script):
 
     slider()
 
-    self.save_component_version_to_structured_out(params.stack_name)
-
   def status(self, env):
     raise ClientComponentHasNoStatus()
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/service_check.py b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/service_check.py
index 33ced03..c18fbc3 100644
--- a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/service_check.py
+++ b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/service_check.py
@@ -40,7 +40,5 @@ class SqoopServiceCheck(Script):
             logoutput = True
     )
 
-    self.save_component_version_to_structured_out(params.stack_name)
-
 if __name__ == "__main__":
   SqoopServiceCheck().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/sqoop_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/sqoop_client.py b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/sqoop_client.py
index db8f188..a795cfc 100644
--- a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/sqoop_client.py
+++ b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/sqoop_client.py
@@ -38,8 +38,6 @@ class SqoopClient(Script):
     env.set_params(params)
     sqoop(type='client')
 
-    self.save_component_version_to_structured_out(params.stack_name)
-
   def status(self, env):
     raise ClientComponentHasNoStatus()
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/nimbus.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/nimbus.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/nimbus.py
index 4b11b82..856ca54 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/nimbus.py
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/nimbus.py
@@ -60,8 +60,6 @@ class Nimbus(Script):
 
     service("nimbus", action="start")
 
-    self.save_component_version_to_structured_out(params.stack_name)
-
   def stop(self, env, rolling_restart=False):
     import params
     env.set_params(params)

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/rest_api.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/rest_api.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/rest_api.py
index f70f67b..9ae82aa 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/rest_api.py
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/rest_api.py
@@ -59,8 +59,6 @@ class StormRestApi(Script):
 
     service("rest_api", action="start")
 
-    self.save_component_version_to_structured_out(params.stack_name)
-
   def stop(self, env, rolling_restart=False):
     import params
     env.set_params(params)

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/supervisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/supervisor.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/supervisor.py
index ef8b95e..e5852a3 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/supervisor.py
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/supervisor.py
@@ -58,8 +58,6 @@ class Supervisor(Script):
     service("supervisor", action="start")
     service("logviewer", action="start")
 
-    self.save_component_version_to_structured_out(params.stack_name)
-
   def stop(self, env, rolling_restart=False):
     import params
     env.set_params(params)

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/params.py b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/params.py
index 13ab77f..84c28a4 100644
--- a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/params.py
@@ -24,6 +24,8 @@ from resource_management import *
 # server configurations
 config = Script.get_config()
 
+stack_name = default("/hostLevelParams/stack_name", None)
+
 # This is expected to be of the form #.#.#.#
 stack_version_unformatted = str(config['hostLevelParams']['stack_version'])
 hdp_stack_version = format_hdp_stack_version(stack_version_unformatted)

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py
index 04cfb90..00375d7 100644
--- a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py
+++ b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py
@@ -25,6 +25,9 @@ from tez import tez
 
 class TezClient(Script):
 
+  def get_stack_to_component(self):
+    return {"HDP": "hadoop-client"}
+
   def pre_rolling_restart(self, env):
     import params
     env.set_params(params)

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/application_timeline_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/application_timeline_server.py b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/application_timeline_server.py
index a8ead39..8971bf5 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/application_timeline_server.py
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/application_timeline_server.py
@@ -57,8 +57,6 @@ class ApplicationTimelineServer(Script):
     self.configure(env) # FOR SECURITY
     service('timelineserver', action='start')
 
-    self.save_component_version_to_structured_out(params.stack_name)
-
   def stop(self, env, rolling_restart=False):
     import params
     env.set_params(params)

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/historyserver.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/historyserver.py b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/historyserver.py
index 4c450ef..45e4d9b 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/historyserver.py
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/historyserver.py
@@ -59,7 +59,6 @@ class HistoryServer(Script):
     copy_tarballs_to_hdfs('mapreduce', 'hadoop-mapreduce-historyserver', params.mapred_user, params.hdfs_user, params.user_group)
     service('historyserver', action='start', serviceName='mapreduce')
 
-    self.save_component_version_to_structured_out(params.stack_name)
 
   def stop(self, env, rolling_restart=False):
     import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/mapreduce2_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/mapreduce2_client.py b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/mapreduce2_client.py
index c4e2800..1f2046a 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/mapreduce2_client.py
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/mapreduce2_client.py
@@ -26,6 +26,9 @@ from yarn import yarn
 
 class MapReduce2Client(Script):
 
+  def get_stack_to_component(self):
+    return {"HDP": "hadoop-client"}
+
   def pre_rolling_restart(self, env):
     import params
     env.set_params(params)

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/nodemanager.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/nodemanager.py b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/nodemanager.py
index 78a75f6..53395ca 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/nodemanager.py
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/nodemanager.py
@@ -58,8 +58,6 @@ class Nodemanager(Script):
     self.configure(env) # FOR SECURITY
     service('nodemanager',action='start')
 
-    self.save_component_version_to_structured_out(params.stack_name)
-
   def post_rolling_restart(self, env):
     Logger.info("Executing NodeManager Rolling Upgrade post-restart")
     import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/resourcemanager.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/resourcemanager.py b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/resourcemanager.py
index 2b8c631..6830a34 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/resourcemanager.py
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/resourcemanager.py
@@ -60,8 +60,6 @@ class Resourcemanager(Script):
             action='start'
     )
 
-    self.save_component_version_to_structured_out(params.stack_name)
-
   def stop(self, env, rolling_restart=False):
     import params
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn_client.py b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn_client.py
index 60b9bce..8f76394 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn_client.py
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn_client.py
@@ -26,6 +26,9 @@ from yarn import yarn
 
 class YarnClient(Script):
 
+  def get_stack_to_component(self):
+    return {"HDP": "hadoop-client"}
+
   def pre_rolling_restart(self, env):
     import params
     env.set_params(params)

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_client.py b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_client.py
index 7d57983..81d3604 100644
--- a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_client.py
+++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_client.py
@@ -39,8 +39,6 @@ class ZookeeperClient(Script):
 
     zookeeper(type='client')
 
-    self.save_component_version_to_structured_out(params.stack_name)
-
   def status(self, env):
     raise ClientComponentHasNoStatus()
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_server.py b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_server.py
index 626ceba..a7ca335 100644
--- a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_server.py
+++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_server.py
@@ -77,8 +77,6 @@ class ZookeeperServer(Script):
     self.configure(env)
     zookeeper_service(action = 'start')
 
-    self.save_component_version_to_structured_out(params.stack_name)
-
   def post_rolling_restart(self, env):
     Logger.info("Executing Rolling Upgrade post-restart")
     import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/hook.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/hook.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/hook.py
index 71ac3df..f412bee 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/hook.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/hook.py
@@ -31,5 +31,7 @@ class AfterInstallHook(Hook):
     setup_hdp_install_directory()
     setup_config()
 
+
 if __name__ == "__main__":
-  AfterInstallHook().execute()
+  h = AfterInstallHook()
+  h.execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/89eeb617/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
index 60f589a..57c0223 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
@@ -893,7 +893,6 @@ public class ClusterTest {
     checkStackVersionState(stack, version, RepositoryVersionState.INSTALLED);
 
     assertStateException(stack, version, RepositoryVersionState.CURRENT, RepositoryVersionState.INSTALLED);
-    assertStateException(stack, version, RepositoryVersionState.UPGRADED, RepositoryVersionState.INSTALLED);
     assertStateException(stack, version, RepositoryVersionState.UPGRADE_FAILED, RepositoryVersionState.INSTALLED);
     assertStateException(stack, version, RepositoryVersionState.INSTALL_FAILED, RepositoryVersionState.INSTALLED);
 


Mime
View raw message