ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vbrodets...@apache.org
Subject ambari git commit: AMBARI-16683. Replace * with hdp version in lzo packages.(vbrodetskyi)
Date Tue, 24 May 2016 18:42:08 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 ba4493c66 -> 3706eea84


AMBARI-16683. Replace * with hdp version in lzo packages.(vbrodetskyi)


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

Branch: refs/heads/branch-2.4
Commit: 3706eea84f882304d3305df45de2d592dbb368dd
Parents: ba4493c
Author: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Authored: Tue May 24 19:25:29 2016 +0300
Committer: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Committed: Tue May 24 19:26:41 2016 +0300

----------------------------------------------------------------------
 .../libraries/functions/get_lzo_packages.py     | 11 +++++++--
 .../libraries/script/script.py                  | 13 +++++++++++
 .../HDFS/2.1.0.2.0/package/scripts/utils.py     | 14 ++++--------
 .../2.1.0.2.0/package/scripts/zkfc_slave.py     | 24 ++++++++++++++++----
 .../python/stacks/2.0.6/HDFS/test_datanode.py   |  3 ++-
 .../stacks/2.0.6/HDFS/test_hdfs_client.py       |  3 ++-
 .../stacks/2.0.6/HDFS/test_journalnode.py       |  3 ++-
 .../python/stacks/2.0.6/HDFS/test_namenode.py   |  1 +
 .../python/stacks/2.0.6/HDFS/test_nfsgateway.py |  2 ++
 .../stacks/2.0.6/OOZIE/test_oozie_client.py     |  2 ++
 .../stacks/2.0.6/OOZIE/test_oozie_server.py     |  2 ++
 .../2.0.6/OOZIE/test_oozie_service_check.py     |  2 ++
 .../src/test/python/stacks/utils/RMFTestCase.py |  1 +
 13 files changed, 63 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3706eea8/ambari-common/src/main/python/resource_management/libraries/functions/get_lzo_packages.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/get_lzo_packages.py
b/ambari-common/src/main/python/resource_management/libraries/functions/get_lzo_packages.py
index e189d62..28605e4 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/get_lzo_packages.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/get_lzo_packages.py
@@ -24,18 +24,25 @@ __all__ = ["get_lzo_packages"]
 from ambari_commons.os_check import OSCheck
 from resource_management.libraries.functions.stack_features import check_stack_feature
 from resource_management.libraries.functions import StackFeature
+from resource_management.libraries.script.script import Script
 
 # TODO: Make list of lzo packages stack driven
 def get_lzo_packages(stack_version_unformatted):
   lzo_packages = []
- 
+  script_instance = Script.get_instance()
+
   if OSCheck.is_redhat_family() or OSCheck.is_suse_family():
     lzo_packages += ["lzo", "hadoop-lzo-native"]
   elif OSCheck.is_ubuntu_family():
     lzo_packages += ["liblzo2-2"]
 
   if stack_version_unformatted and check_stack_feature(StackFeature.ROLLING_UPGRADE, stack_version_unformatted):
-    lzo_packages += ["hadooplzo_*"]
+    if OSCheck.is_ubuntu_family():
+      lzo_packages += [script_instance.format_package_name("hadooplzo-${stack_version}")
,
+                       script_instance.format_package_name("hadooplzo-${stack_version}-native")]
+    else:
+      lzo_packages += [script_instance.format_package_name("hadooplzo_${stack_version}"),
+                       script_instance.format_package_name("hadooplzo_${stack_version}-native")]
   else:
     lzo_packages += ["hadoop-lzo"]
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/3706eea8/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 0dcbea8..61759cc 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
@@ -92,6 +92,9 @@ def get_path_from_configuration(name, configuration):
   return configuration
 
 class Script(object):
+
+  instance = None
+
   """
   Executes a command for custom service. stdout and stderr are written to
   tmpoutfile and to tmperrfile respectively.
@@ -790,3 +793,13 @@ class Script(object):
 
     finally:
       Directory(conf_tmp_dir, action="delete")
+
+  @staticmethod
+  def get_instance():
+    if Script.instance is None:
+      Script.instance = Script()
+    return Script.instance
+
+  def __init__(self):
+    if Script.instance is not None:
+      raise Fail("An instantiation already exists! Use, get_instance() method.")
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/3706eea8/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/utils.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/utils.py
b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/utils.py
index ceee738..dfba302 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/utils.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/utils.py
@@ -36,7 +36,7 @@ from resource_management.libraries.functions.namenode_ha_utils import get_nameno
 from resource_management.libraries.script.script import Script
 from resource_management.libraries.functions.show_logs import show_logs
 
-from zkfc_slave import ZkfcSlave
+from zkfc_slave import ZkfcSlaveDefault
 
 def safe_zkfc_op(action, env):
   """
@@ -48,21 +48,17 @@ def safe_zkfc_op(action, env):
   zkfc = None
   if action == "start":
     try:
-      zkfc = ZkfcSlave()
-      zkfc.status(env)
+      ZkfcSlaveDefault.status_static(env)
     except ComponentIsNotRunning:
-      if zkfc:
-        zkfc.start(env)
+      ZkfcSlaveDefault.start_static(env)
 
   if action == "stop":
     try:
-      zkfc = ZkfcSlave()
-      zkfc.status(env)
+      ZkfcSlaveDefault.status_static(env)
     except ComponentIsNotRunning:
       pass
     else:
-      if zkfc:
-        zkfc.stop(env)
+      ZkfcSlaveDefault.stop_static(env)
 
 def initiate_safe_zkfc_failover():
   """

http://git-wip-us.apache.org/repos/asf/ambari/blob/3706eea8/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/zkfc_slave.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/zkfc_slave.py
b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/zkfc_slave.py
index 94d9955..61489bd 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/zkfc_slave.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/zkfc_slave.py
@@ -40,8 +40,12 @@ class ZkfcSlave(Script):
     import params
     env.set_params(params)
     self.install_packages(env)
-
-  def configure(self, env):
+    
+  def configure(env):
+    ZkfcSlave.configure_static(env)
+    
+  @staticmethod
+  def configure_static(env):
     import params
     env.set_params(params)
     hdfs("zkfc_slave")
@@ -51,10 +55,14 @@ class ZkfcSlave(Script):
 class ZkfcSlaveDefault(ZkfcSlave):
 
   def start(self, env, upgrade_type=None):
+    ZkfcSlaveDefault.start_static(env, upgrade_type)
+    
+  @staticmethod
+  def start_static(env, upgrade_type=None):
     import params
 
     env.set_params(params)
-    self.configure(env)
+    ZkfcSlave.configure_static(env)
     Directory(params.hadoop_pid_dir_prefix,
               mode=0755,
               owner=params.hdfs_user,
@@ -75,8 +83,12 @@ class ZkfcSlaveDefault(ZkfcSlave):
       action="start", name="zkfc", user=params.hdfs_user, create_pid_dir=True,
       create_log_dir=True
     )
-
+  
   def stop(self, env, upgrade_type=None):
+    ZkfcSlaveDefault.stop_static(env, upgrade_type)
+
+  @staticmethod
+  def stop_static(env, upgrade_type=None):
     import params
 
     env.set_params(params)
@@ -87,6 +99,10 @@ class ZkfcSlaveDefault(ZkfcSlave):
 
 
   def status(self, env):
+    ZkfcSlaveDefault.status_static(env, upgrade_type)
+    
+  @staticmethod
+  def status_static(env):
     import status_params
     env.set_params(status_params)
     check_process_status(status_params.zkfc_pid_file)

http://git-wip-us.apache.org/repos/asf/ambari/blob/3706eea8/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_datanode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_datanode.py b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_datanode.py
index 90c12ca..1b599ef 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_datanode.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_datanode.py
@@ -20,12 +20,13 @@ limitations under the License.
 from stacks.utils.RMFTestCase import *
 import json
 from mock.mock import MagicMock, patch
-from resource_management.libraries.script import Script
+from resource_management.libraries.script.script import Script
 from resource_management.core import shell
 from resource_management.core.exceptions import Fail
 import resource_management.libraries.functions.dfs_datanode_helper
 
 @patch.object(resource_management.libraries.functions, 'check_process_status', new = MagicMock())
+@patch.object(Script, 'format_package_name', new = MagicMock())
 class TestDatanode(RMFTestCase):
   COMMON_SERVICES_PACKAGE_DIR = "HDFS/2.1.0.2.0/package"
   STACK_VERSION = "2.0.6"

http://git-wip-us.apache.org/repos/asf/ambari/blob/3706eea8/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_hdfs_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_hdfs_client.py b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_hdfs_client.py
index a165718..b2636ab 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_hdfs_client.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_hdfs_client.py
@@ -24,8 +24,9 @@ import tarfile
 import contextlib
 from resource_management import *
 from stacks.utils.RMFTestCase import *
+from resource_management.libraries.script.script import Script
 
-
+@patch.object(Script, 'format_package_name', new = MagicMock())
 @patch("platform.linux_distribution", new = MagicMock(return_value="Linux"))
 @patch.object(tarfile,"open", new = MagicMock())
 @patch.object(tempfile,"mkdtemp", new = MagicMock(return_value='/tmp/123'))

http://git-wip-us.apache.org/repos/asf/ambari/blob/3706eea8/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_journalnode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_journalnode.py b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_journalnode.py
index 08eab25..523b9aa 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_journalnode.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_journalnode.py
@@ -21,8 +21,9 @@ import json
 import os
 from stacks.utils.RMFTestCase import *
 from mock.mock import MagicMock, patch
+from resource_management.libraries.script.script import Script
 
-
+@patch.object(Script, 'format_package_name', new = MagicMock())
 class TestJournalnode(RMFTestCase):
   COMMON_SERVICES_PACKAGE_DIR = "HDFS/2.1.0.2.0/package"
   STACK_VERSION = "2.0.6"

http://git-wip-us.apache.org/repos/asf/ambari/blob/3706eea8/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py
index 34b639e..4a89b0a 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py
@@ -29,6 +29,7 @@ from resource_management.core import shell
 from resource_management.core.exceptions import Fail
 
 
+@patch.object(Script, 'format_package_name', new = MagicMock())
 class TestNamenode(RMFTestCase):
   COMMON_SERVICES_PACKAGE_DIR = "HDFS/2.1.0.2.0/package"
   STACK_VERSION = "2.0.6"

http://git-wip-us.apache.org/repos/asf/ambari/blob/3706eea8/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_nfsgateway.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_nfsgateway.py b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_nfsgateway.py
index c8e7d27..396778d 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_nfsgateway.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_nfsgateway.py
@@ -21,12 +21,14 @@ import os
 import json
 from stacks.utils.RMFTestCase import *
 from mock.mock import MagicMock, patch
+from resource_management.libraries.script.script import Script
 
 from only_for_platform import not_for_platform, PLATFORM_WINDOWS
 
 # NFS GATEWAY is always started by root using jsvc due to rpcbind bugs
 # on Linux such as CentOS6.2. https://bugzilla.redhat.com/show_bug.cgi?id=731542
 @not_for_platform(PLATFORM_WINDOWS)
+@patch.object(Script, 'format_package_name', new = MagicMock())
 class TestNFSGateway(RMFTestCase):
   COMMON_SERVICES_PACKAGE_DIR = "HDFS/2.1.0.2.0/package"
   STACK_VERSION = "2.0.6"

http://git-wip-us.apache.org/repos/asf/ambari/blob/3706eea8/ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_client.py b/ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_client.py
index 46cacf5..70fcb3f 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_client.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_client.py
@@ -19,8 +19,10 @@ limitations under the License.
 '''
 from mock.mock import MagicMock, call, patch
 from stacks.utils.RMFTestCase import *
+from resource_management.libraries.script.script import Script
 import json
 
+@patch.object(Script, 'format_package_name', new = MagicMock())
 @patch("platform.linux_distribution", new = MagicMock(return_value="Linux"))
 class TestOozieClient(RMFTestCase):
   COMMON_SERVICES_PACKAGE_DIR = "OOZIE/4.0.0.2.0/package"

http://git-wip-us.apache.org/repos/asf/ambari/blob/3706eea8/ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_server.py b/ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_server.py
index e43f6dc..99d6dec 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_server.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_server.py
@@ -21,12 +21,14 @@ limitations under the License.
 import json
 from mock.mock import MagicMock, call, patch
 from stacks.utils.RMFTestCase import *
+from resource_management.libraries.script.script import Script
 from resource_management.core import shell
 from resource_management.core.exceptions import Fail
 from resource_management.libraries import functions
 from resource_management.libraries.providers.hdfs_resource import WebHDFSUtil
 import tempfile
 
+@patch.object(Script, 'format_package_name', new = MagicMock())
 @patch("platform.linux_distribution", new = MagicMock(return_value="Linux"))
 @patch.object(WebHDFSUtil, "run_command", new=MagicMock(return_value={}))
 @patch.object(tempfile, "gettempdir", new=MagicMock(return_value="/tmp"))

http://git-wip-us.apache.org/repos/asf/ambari/blob/3706eea8/ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_service_check.py
b/ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_service_check.py
index 646f5db..f489755 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_service_check.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_service_check.py
@@ -19,8 +19,10 @@ limitations under the License.
 '''
 from mock.mock import MagicMock, call, patch
 from stacks.utils.RMFTestCase import *
+from resource_management.libraries.script.script import Script
 import json
 
+@patch.object(Script, 'format_package_name', new = MagicMock())
 @patch("platform.linux_distribution", new = MagicMock(return_value="Linux"))
 class TestOozieServiceCheck(RMFTestCase):
   COMMON_SERVICES_PACKAGE_DIR = "OOZIE/4.0.0.2.0/package"

http://git-wip-us.apache.org/repos/asf/ambari/blob/3706eea8/ambari-server/src/test/python/stacks/utils/RMFTestCase.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/utils/RMFTestCase.py b/ambari-server/src/test/python/stacks/utils/RMFTestCase.py
index ebb3cbc..74454e5 100644
--- a/ambari-server/src/test/python/stacks/utils/RMFTestCase.py
+++ b/ambari-server/src/test/python/stacks/utils/RMFTestCase.py
@@ -115,6 +115,7 @@ class RMFTestCase(TestCase):
     try:
       with patch.object(platform, 'linux_distribution', return_value=os_type):
         script_module = imp.load_source(classname, script_path)
+        Script.instance = None
         script_class_inst = RMFTestCase._get_attr(script_module, classname)()
         script_class_inst.log_out_files = log_out_files
         method = RMFTestCase._get_attr(script_class_inst, command)


Mime
View raw message