Repository: ambari Updated Branches: refs/heads/trunk 74f314598 -> b65b7c2dd
AMBARI-15475: Editing tmp dir from single to multiple dir doesn't trigger the backend change Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b65b7c2d Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b65b7c2d Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b65b7c2d Branch: refs/heads/trunk Commit: b65b7c2ddbe6e11d8c0514346f2c00da3feceaae Parents: 74f3145 Author: Jun Aoki <ja...@apache.org> Authored: Sat Mar 19 01:13:08 2016 -0700 Committer: Jun Aoki <ja...@apache.org> Committed: Sat Mar 19 01:13:08 2016 -0700 ---------------------------------------------------------------------- .../HAWQ/2.0.0/package/scripts/common.py | 14 ++++++++++++++ .../HAWQ/2.0.0/package/scripts/hawqsegment.py | 7 +++---- .../HAWQ/2.0.0/package/scripts/master_helper.py | 15 ++------------- .../HAWQ/2.0.0/package/scripts/params.py | 4 ++-- .../test/python/stacks/2.3/HAWQ/test_hawqmaster.py | 10 +++++----- .../test/python/stacks/2.3/HAWQ/test_hawqsegment.py | 13 +++++++++---- .../test/python/stacks/2.3/HAWQ/test_hawqstandby.py | 10 +++++----- 7 files changed, 40 insertions(+), 33 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/b65b7c2d/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py index 00349d8..0631144 100644 --- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py +++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py @@ -52,6 +52,20 @@ def __create_hawq_user(): groups=[hawq_constants.hawq_group, params.user_group], ignore_failures=True) +def create_master_dir(dir_path): + """ + Creates the master directory (hawq_master_dir or hawq_segment_dir) for HAWQ + """ + utils.create_dir_as_hawq_user(dir_path) + Execute("chmod 700 {0}".format(dir_path), user=hawq_constants.root_user, timeout=hawq_constants.default_exec_timeout) + +def create_temp_dirs(dir_paths): + """ + Creates the temp directories (hawq_master_temp_dir or hawq_segment_temp_dir) for HAWQ + """ + for path in dir_paths.split(','): + if path != "": + utils.create_dir_as_hawq_user(path) def __set_home_dir_ownership(): """ http://git-wip-us.apache.org/repos/asf/ambari/blob/b65b7c2d/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqsegment.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqsegment.py b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqsegment.py index 0a597b6..1891ede 100644 --- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqsegment.py +++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqsegment.py @@ -42,6 +42,8 @@ class HawqSegment(Script): env.set_params(hawq_constants) common.setup_user() common.setup_common_configurations() + # temp directories are stateless and they should be recreated when configured (started) + common.create_temp_dirs(params.hawq_segment_temp_dirs) def __start_segment(self): @@ -80,10 +82,7 @@ class HawqSegment(Script): @staticmethod def __init_segment(): import params - - # Create segment directories - utils.create_dir_as_hawq_user(params.hawq_segment_dir) - utils.create_dir_as_hawq_user(params.hawq_segment_temp_dir.split(',')) + common.create_master_dir(params.hawq_segment_dir) # Initialize hawq segment utils.exec_hawq_operation(hawq_constants.INIT, "{0} -a -v".format(hawq_constants.SEGMENT)) http://git-wip-us.apache.org/repos/asf/ambari/blob/b65b7c2d/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py index 9482b35..330b6c0 100644 --- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py +++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py @@ -59,20 +59,9 @@ def configure_master(): common.setup_user() common.setup_common_configurations() __setup_master_specific_conf_files() - __create_local_dirs() - - -def __create_local_dirs(): - """ - Creates the required local directories for HAWQ - """ import params - # Create Master directories - utils.create_dir_as_hawq_user(params.hawq_master_dir) - utils.create_dir_as_hawq_user(params.hawq_master_temp_dir.split(',')) - - Execute("chmod 700 {0}".format(params.hawq_master_dir), user=hawq_constants.root_user, timeout=hawq_constants.default_exec_timeout) - + common.create_master_dir(params.hawq_master_dir) + common.create_temp_dirs(params.hawq_master_temp_dirs) def __setup_hdfs_dirs(): """ http://git-wip-us.apache.org/repos/asf/ambari/blob/b65b7c2d/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/params.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/params.py index 1bdc5aa..d3c9009 100644 --- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/params.py +++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/params.py @@ -138,8 +138,8 @@ yarn_client = config['configurations']['yarn-client'] # Directories and ports hawq_master_dir = hawq_site.get('hawq_master_directory') hawq_segment_dir = hawq_site.get('hawq_segment_directory') -hawq_master_temp_dir = hawq_site.get('hawq_master_temp_directory') -hawq_segment_temp_dir = hawq_site.get('hawq_segment_temp_directory') +hawq_master_temp_dirs = hawq_site.get('hawq_master_temp_directory') +hawq_segment_temp_dirs = hawq_site.get('hawq_segment_temp_directory') # Extract hawq hdfs directory from hdfs url. Ex: /hawq/hawq_default from # host:8080/hawq/hawq_default hawq_hdfs_data_dir = "/{0}".format(hawq_site.get('hawq_dfs_url').split('/', 1)[1]) http://git-wip-us.apache.org/repos/asf/ambari/blob/b65b7c2d/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqmaster.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqmaster.py b/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqmaster.py index 944c540..3907ad9 100644 --- a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqmaster.py +++ b/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqmaster.py @@ -100,17 +100,17 @@ class TestHawqMaster(RMFTestCase): create_parents = True ) + self.assertResourceCalled('Execute', 'chmod 700 /data/hawq/master', + user = 'root', + timeout = 600 + ) + self.assertResourceCalled('Directory', '/tmp/hawq/master', group = self.GPADMIN, owner = self.GPADMIN, create_parents = True ) - self.assertResourceCalled('Execute', 'chmod 700 /data/hawq/master', - user = 'root', - timeout = 600 - ) - @patch ('hawqmaster.common.__set_osparams') def test_configure_default(self, set_osparams_mock): http://git-wip-us.apache.org/repos/asf/ambari/blob/b65b7c2d/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqsegment.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqsegment.py b/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqsegment.py index 2847405..8049821 100644 --- a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqsegment.py +++ b/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqsegment.py @@ -70,6 +70,12 @@ class TestHawqSegment(RMFTestCase): mode = 0644 ) + self.assertResourceCalled('Directory', '/tmp/hawq/segment', + owner = self.GPADMIN, + group = self.GPADMIN, + create_parents = True + ) + @patch ('hawqsegment.common.__set_osparams') @@ -121,10 +127,9 @@ class TestHawqSegment(RMFTestCase): create_parents = True ) - self.assertResourceCalled('Directory', '/tmp/hawq/segment', - owner = self.GPADMIN, - group = self.GPADMIN, - create_parents = True + self.assertResourceCalled('Execute', 'chmod 700 /data/hawq/segment', + user = 'root', + timeout = 600 ) self.assertResourceCalled('Execute', 'source /usr/local/hawq/greenplum_path.sh && hawq init segment -a -v', http://git-wip-us.apache.org/repos/asf/ambari/blob/b65b7c2d/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqstandby.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqstandby.py b/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqstandby.py index 56a3f44..039d109 100644 --- a/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqstandby.py +++ b/ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqstandby.py @@ -98,17 +98,17 @@ class TestHawqStandby(RMFTestCase): create_parents = True ) + self.assertResourceCalled('Execute', 'chmod 700 /data/hawq/master', + user = 'root', + timeout = 600 + ) + self.assertResourceCalled('Directory', '/tmp/hawq/master', group = self.GPADMIN, owner = self.GPADMIN, create_parents = True ) - self.assertResourceCalled('Execute', 'chmod 700 /data/hawq/master', - user = 'root', - timeout = 600 - ) - @patch ('hawqstandby.common.__set_osparams') def test_configure_default(self, set_osparams_mock):