ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smoha...@apache.org
Subject [1/2] ambari git commit: AMBARI-11721. Handle if non-default value is used for hbase.tmp.dir (Dmytro Shkvyra via smohanty)
Date Wed, 17 Jun 2015 20:00:50 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 54b715b5c -> 0f68af11b


AMBARI-11721. Handle if non-default value is used for hbase.tmp.dir (Dmytro Shkvyra via smohanty)


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

Branch: refs/heads/branch-2.1
Commit: 6837802dc4b43386756ffef32d86a2d15f8f80e5
Parents: 54b715b
Author: Sumit Mohanty <smohanty@hortonworks.com>
Authored: Wed Jun 17 12:57:17 2015 -0700
Committer: Sumit Mohanty <smohanty@hortonworks.com>
Committed: Wed Jun 17 13:00:18 2015 -0700

----------------------------------------------------------------------
 .../HBASE/0.96.0.2.0/package/scripts/hbase.py   | 32 +++------
 .../0.96.0.2.0/package/scripts/params_linux.py  |  7 +-
 .../stacks/2.0.6/HBASE/test_hbase_client.py     | 52 ++++----------
 .../stacks/2.0.6/HBASE/test_hbase_master.py     | 75 ++++++--------------
 .../2.0.6/HBASE/test_hbase_regionserver.py      | 69 +++++-------------
 .../2.0.6/HBASE/test_phoenix_queryserver.py     | 52 ++++----------
 6 files changed, 84 insertions(+), 203 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6837802d/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase.py
b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase.py
index 1bfa7e4..793a44b 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase.py
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase.py
@@ -55,27 +55,17 @@ def hbase(name=None):
       group = params.user_group,
       recursive = True
   )
-
-  Directory (params.tmp_dir,
-             owner = params.hbase_user,
-             mode=0775,
-             recursive = True,
-             cd_access="a",
-  )
-
-  Directory (params.local_dir,
-             owner = params.hbase_user,
-             group = params.user_group,
-             mode=0775,
-             recursive = True
-  )
-
-  Directory (os.path.join(params.local_dir, "jars"),
-             owner = params.hbase_user,
-             group = params.user_group,
-             mode=0775,
-             recursive = True
-  )
+  
+  parent_dir = os.path.dirname(params.tmp_dir)
+  # In case if we have several placeholders in path
+  while ("${" in parent_dir):
+    parent_dir = os.path.dirname(parent_dir)
+  if parent_dir != os.path.abspath(os.sep) :
+    Directory (parent_dir,
+          recursive = True,
+          cd_access="a",
+    )
+    Execute(("chmod", "1777", parent_dir), sudo=True)
 
   XmlConfig( "hbase-site.xml",
             conf_dir = params.hbase_conf_dir,

http://git-wip-us.apache.org/repos/asf/ambari/blob/6837802d/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
index e8585cd..fdc9c0a 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
@@ -107,11 +107,8 @@ regionserver_xmn_size = calc_xmn_from_xms(regionserver_heapsize, regionserver_xm
 
 
 pid_dir = status_params.pid_dir
-tmp_dir = "/tmp/hbase-hbase"
-# TODO UPGRADE default, update site during upgrade
-local_dir = "/tmp/hbase-hbase/local"
-# _local_dir_conf = "/tmp/hbase-hbase/local"
-# local_dir = substitute_vars(_local_dir_conf, config['configurations']['hbase-site'])
+tmp_dir = config['configurations']['hbase-site']['hbase.tmp.dir']
+local_dir = config['configurations']['hbase-site']['hbase.local.dir']
 
 client_jaas_config_file = format("{hbase_conf_dir}/hbase_client_jaas.conf")
 master_jaas_config_file = format("{hbase_conf_dir}/hbase_master_jaas.conf")

http://git-wip-us.apache.org/repos/asf/ambari/blob/6837802d/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_client.py b/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_client.py
index afe3de6..aaeaf2d 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_client.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_client.py
@@ -27,7 +27,7 @@ from stacks.utils.RMFTestCase import *
 class TestHBaseClient(RMFTestCase):
   COMMON_SERVICES_PACKAGE_DIR = "HBASE/0.96.0.2.0/package"
   STACK_VERSION = "2.0.6"
-  TMP_PATH = '/tmp/hbase-hbase'
+  TMP_PATH = '/hadoop'
 
   def test_configure_secured(self):
     self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/hbase_client.py",
@@ -46,24 +46,13 @@ class TestHBaseClient(RMFTestCase):
       group = 'hadoop',
       recursive = True,
     )
-    self.assertResourceCalled('Directory', self.TMP_PATH,
-      owner = 'hbase',
-      mode=0775,
-      recursive = True,
-      cd_access='a'
-    )
-    self.assertResourceCalled('Directory', self.TMP_PATH + '/local',
-      owner = 'hbase',
-      group = 'hadoop',
-      mode=0775,
-      recursive = True,
-    )
-    self.assertResourceCalled('Directory', self.TMP_PATH + '/local/jars',
-      owner = 'hbase',
-      group = 'hadoop',
-      mode=0775,
-      recursive = True,
-    )
+    self.assertResourceCalled('Directory', '/hadoop',
+                              recursive = True,
+                              cd_access = 'a',
+                              )
+    self.assertResourceCalled('Execute', ('chmod', '1777', u'/hadoop'),
+                              sudo = True,
+                              )
     self.assertResourceCalled('XmlConfig', 'hbase-site.xml',
       owner = 'hbase',
       group = 'hadoop',
@@ -137,24 +126,13 @@ class TestHBaseClient(RMFTestCase):
       group = 'hadoop',
       recursive = True,
     )
-    self.assertResourceCalled('Directory', self.TMP_PATH,
-      owner = 'hbase',
-      mode=0775,
-      recursive = True,
-      cd_access='a'
-    )
-    self.assertResourceCalled('Directory', self.TMP_PATH + '/local',
-      owner = 'hbase',
-      group = 'hadoop',
-      mode=0775,
-      recursive = True,
-    )
-    self.assertResourceCalled('Directory', self.TMP_PATH + '/local/jars',
-      owner = 'hbase',
-      group = 'hadoop',
-      mode=0775,
-      recursive = True,
-    )
+    self.assertResourceCalled('Directory', '/hadoop',
+                              recursive = True,
+                              cd_access = 'a',
+                              )
+    self.assertResourceCalled('Execute', ('chmod', '1777', u'/hadoop'),
+                              sudo = True,
+                              )
     self.assertResourceCalled('XmlConfig', 'hbase-site.xml',
       owner = 'hbase',
       group = 'hadoop',

http://git-wip-us.apache.org/repos/asf/ambari/blob/6837802d/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_master.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_master.py b/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_master.py
index da0d624..6454e13 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_master.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_master.py
@@ -26,7 +26,7 @@ from stacks.utils.RMFTestCase import *
 class TestHBaseMaster(RMFTestCase):
   COMMON_SERVICES_PACKAGE_DIR = "HBASE/0.96.0.2.0/package"
   STACK_VERSION = "2.0.6"
-  TMP_PATH = "/tmp/hbase-hbase"
+  TMP_PATH = "/hadoop"
 
   def test_configure_default(self):
     self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/hbase_master.py",
@@ -204,24 +204,13 @@ class TestHBaseMaster(RMFTestCase):
       group = 'hadoop',
       recursive = True,
     )
-    self.assertResourceCalled('Directory', self.TMP_PATH,
-      owner = 'hbase',
-      mode = 0775,
-      recursive = True,
-      cd_access='a'
-    )
-    self.assertResourceCalled('Directory', self.TMP_PATH + '/local',
-      owner = 'hbase',
-      group = 'hadoop',
-      mode=0775,
-      recursive = True,
-    )
-    self.assertResourceCalled('Directory', self.TMP_PATH + '/local/jars',
-      owner = 'hbase',
-      group = 'hadoop',
-      mode=0775,
-      recursive = True,
-    )
+    self.assertResourceCalled('Directory', '/hadoop',
+                              recursive = True,
+                              cd_access = 'a',
+                              )
+    self.assertResourceCalled('Execute', ('chmod', '1777', u'/hadoop'),
+                              sudo = True,
+                              )
     self.assertResourceCalled('XmlConfig', 'hbase-site.xml',
       owner = 'hbase',
       group = 'hadoop',
@@ -327,24 +316,13 @@ class TestHBaseMaster(RMFTestCase):
       group = 'hadoop',
       recursive = True,
     )
-    self.assertResourceCalled('Directory', self.TMP_PATH,
-      owner = 'hbase',
-      mode = 0775,
-      recursive = True,
-      cd_access='a'
-    )
-    self.assertResourceCalled('Directory', self.TMP_PATH + '/local',
-      owner = 'hbase',
-      group = 'hadoop',
-      mode=0775,
-      recursive = True
-    )
-    self.assertResourceCalled('Directory', self.TMP_PATH + '/local/jars',
-      owner = 'hbase',
-      group = 'hadoop',
-      mode=0775,
-      recursive = True,
-    )
+    self.assertResourceCalled('Directory', '/hadoop',
+                              recursive = True,
+                              cd_access = 'a',
+                              )
+    self.assertResourceCalled('Execute', ('chmod', '1777', u'/hadoop'),
+                              sudo = True,
+                              )
     self.assertResourceCalled('XmlConfig', 'hbase-site.xml',
       owner = 'hbase',
       group = 'hadoop',
@@ -460,23 +438,14 @@ class TestHBaseMaster(RMFTestCase):
       group = 'hadoop',
       recursive = True)
 
-    self.assertResourceCalled('Directory', self.TMP_PATH,
-      owner = 'hbase',
-      mode = 0775,
-      recursive = True,
-      cd_access='a')
-
-    self.assertResourceCalled('Directory', self.TMP_PATH + '/local',
-      owner = 'hbase',
-      group = 'hadoop',
-      mode=0775,
-      recursive = True)
+    self.assertResourceCalled('Directory', '/hadoop',
+                              recursive = True,
+                              cd_access = 'a',
+                              )
 
-    self.assertResourceCalled('Directory', self.TMP_PATH + '/local/jars',
-      owner = 'hbase',
-      group = 'hadoop',
-      mode=0775,
-      recursive = True)
+    self.assertResourceCalled('Execute', ('chmod', '1777', u'/hadoop'),
+                              sudo = True,
+                              )
 
     self.assertResourceCalled('XmlConfig', 'hbase-site.xml',
       owner = 'hbase',

http://git-wip-us.apache.org/repos/asf/ambari/blob/6837802d/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_regionserver.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_regionserver.py b/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_regionserver.py
index 47e8ef3..19b5485 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_regionserver.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_regionserver.py
@@ -26,7 +26,7 @@ from stacks.utils.RMFTestCase import *
 class TestHbaseRegionServer(RMFTestCase):
   COMMON_SERVICES_PACKAGE_DIR = "HBASE/0.96.0.2.0/package"
   STACK_VERSION = "2.0.6"
-  TMP_PATH = '/tmp/hbase-hbase'
+  TMP_PATH = '/hadoop'
 
   def test_configure_default(self):
     self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/hbase_regionserver.py",
@@ -131,23 +131,12 @@ class TestHbaseRegionServer(RMFTestCase):
       group = 'hadoop',
       recursive = True,
     )
-    self.assertResourceCalled('Directory', self.TMP_PATH,
-      owner = 'hbase',
-      mode=0775,
+    self.assertResourceCalled('Directory', '/hadoop',
       recursive = True,
-      cd_access='a'
+      cd_access = 'a',
     )
-    self.assertResourceCalled('Directory', self.TMP_PATH + '/local',
-      owner = 'hbase',
-      group = 'hadoop',
-      mode=0775,
-      recursive = True,
-    )
-    self.assertResourceCalled('Directory', self.TMP_PATH +'/local/jars',
-      owner = 'hbase',
-      group = 'hadoop',
-      mode=0775,
-      recursive = True,
+    self.assertResourceCalled('Execute', ('chmod', '1777', u'/hadoop'),
+      sudo = True,
     )
     self.assertResourceCalled('XmlConfig', 'hbase-site.xml',
       owner = 'hbase',
@@ -218,24 +207,13 @@ class TestHbaseRegionServer(RMFTestCase):
       group = 'hadoop',
       recursive = True,
     )
-    self.assertResourceCalled('Directory', self.TMP_PATH,
-      owner = 'hbase',
-      mode=0775,
-      recursive = True,
-      cd_access='a'
-    )
-    self.assertResourceCalled('Directory', self.TMP_PATH + '/local',
-      owner = 'hbase',
-      group = 'hadoop',
-      mode=0775,
-      recursive = True,
-    )
-    self.assertResourceCalled('Directory', self.TMP_PATH + '/local/jars',
-      owner = 'hbase',
-      group = 'hadoop',
-      mode=0775,
-      recursive = True,
-    )
+    self.assertResourceCalled('Directory', '/hadoop',
+                              recursive = True,
+                              cd_access = 'a',
+                              )
+    self.assertResourceCalled('Execute', ('chmod', '1777', u'/hadoop'),
+                              sudo = True,
+                              )
     self.assertResourceCalled('XmlConfig', 'hbase-site.xml',
       owner = 'hbase',
       group = 'hadoop',
@@ -316,23 +294,14 @@ class TestHbaseRegionServer(RMFTestCase):
       group = 'hadoop',
       recursive = True)
 
-    self.assertResourceCalled('Directory', self.TMP_PATH,
-      owner = 'hbase',
-      mode = 0775,
-      recursive = True,
-      cd_access='a')
-
-    self.assertResourceCalled('Directory', self.TMP_PATH + '/local',
-      owner = 'hbase',
-      group = 'hadoop',
-      mode=0775,
-      recursive = True)
+    self.assertResourceCalled('Directory', '/hadoop',
+                              recursive = True,
+                              cd_access = 'a',
+                              )
 
-    self.assertResourceCalled('Directory', self.TMP_PATH + '/local/jars',
-      owner = 'hbase',
-      group = 'hadoop',
-      mode=0775,
-      recursive = True)
+    self.assertResourceCalled('Execute', ('chmod', '1777', u'/hadoop'),
+                              sudo = True,
+                              )
 
     self.assertResourceCalled('XmlConfig', 'hbase-site.xml',
       owner = 'hbase',

http://git-wip-us.apache.org/repos/asf/ambari/blob/6837802d/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_phoenix_queryserver.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_phoenix_queryserver.py
b/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_phoenix_queryserver.py
index 5bbaa80..436660e 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_phoenix_queryserver.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_phoenix_queryserver.py
@@ -29,7 +29,7 @@ from unittest import skip
 class TestPhoenixQueryServer(RMFTestCase):
   COMMON_SERVICES_PACKAGE_DIR = "HBASE/0.96.0.2.0/package"
   STACK_VERSION = "2.3"
-  TMP_PATH = "/tmp/hbase-hbase"
+  TMP_PATH = "/hadoop"
 
   def test_configure_default(self):
     self.executeScript(
@@ -213,24 +213,13 @@ class TestPhoenixQueryServer(RMFTestCase):
       group = 'hadoop',
       recursive = True,
     )
-    self.assertResourceCalled('Directory', self.TMP_PATH,
-      owner = 'hbase',
-      mode = 0775,
-      recursive = True,
-      cd_access = 'a'
-    )
-    self.assertResourceCalled('Directory', self.TMP_PATH + '/local',
-      owner = 'hbase',
-      group = 'hadoop',
-      mode = 0775,
-      recursive = True,
-    )
-    self.assertResourceCalled('Directory', self.TMP_PATH + '/local/jars',
-      owner = 'hbase',
-      group = 'hadoop',
-      mode = 0775,
-      recursive = True,
-    )
+    self.assertResourceCalled('Directory', '/hadoop',
+                              recursive = True,
+                              cd_access = 'a',
+                              )
+    self.assertResourceCalled('Execute', ('chmod', '1777', u'/hadoop'),
+                              sudo = True,
+                              )
     self.assertResourceCalled('XmlConfig', 'hbase-site.xml',
       owner = 'hbase',
       group = 'hadoop',
@@ -313,24 +302,13 @@ class TestPhoenixQueryServer(RMFTestCase):
       group = 'hadoop',
       recursive = True,
     )
-    self.assertResourceCalled('Directory', self.TMP_PATH,
-      owner = 'hbase',
-      mode = 0775,
-      recursive = True,
-      cd_access = 'a'
-    )
-    self.assertResourceCalled('Directory', self.TMP_PATH + '/local',
-      owner = 'hbase',
-      group = 'hadoop',
-      mode = 0775,
-      recursive = True,
-    )
-    self.assertResourceCalled('Directory', self.TMP_PATH + '/local/jars',
-      owner = 'hbase',
-      group = 'hadoop',
-      mode = 0775,
-      recursive = True,
-    )
+    self.assertResourceCalled('Directory', '/hadoop',
+                              recursive = True,
+                              cd_access = 'a',
+                              )
+    self.assertResourceCalled('Execute', ('chmod', '1777', u'/hadoop'),
+                              sudo = True,
+                              )
     self.assertResourceCalled('XmlConfig', 'hbase-site.xml',
       owner = 'hbase',
       group = 'hadoop',


Mime
View raw message