AMBARI-7486 Hive service start fails after moving WebHCat to Hive in HDP2.2 (dsen)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0d220839 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0d220839 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0d220839 Branch: refs/heads/branch-alerts-dev Commit: 0d220839cdc7a18e1416035b0b88610165b9fe19 Parents: 344a96f Author: Dmytro Sen <[email protected]> Authored: Thu Sep 25 16:01:29 2014 +0300 Committer: Dmytro Sen <[email protected]> Committed: Thu Sep 25 16:40:47 2014 +0300 ---------------------------------------------------------------------- .../src/test/python/resource_management/TestCopyFromLocal.py | 4 ++-- .../libraries/providers/copy_from_local.py | 2 +- .../HDP/2.0.6/services/HIVE/package/scripts/hive_service.py | 3 ++- .../stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py | 2 +- .../src/test/python/stacks/2.0.6/HIVE/test_hive_metastore.py | 8 ++++---- .../src/test/python/stacks/2.0.6/HIVE/test_hive_server.py | 8 ++++---- .../src/test/python/stacks/2.1/HIVE/test_hive_metastore.py | 8 ++++---- 7 files changed, 18 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/0d220839/ambari-agent/src/test/python/resource_management/TestCopyFromLocal.py ---------------------------------------------------------------------- diff --git a/ambari-agent/src/test/python/resource_management/TestCopyFromLocal.py b/ambari-agent/src/test/python/resource_management/TestCopyFromLocal.py index 3991bae..32a7963 100644 --- a/ambari-agent/src/test/python/resource_management/TestCopyFromLocal.py +++ b/ambari-agent/src/test/python/resource_management/TestCopyFromLocal.py @@ -36,7 +36,7 @@ class TestCopyFromLocal(TestCase): call_arg_list = execute_hadoop_mock.call_args_list self.assertEqual('fs -copyFromLocal /user/testdir/*.files /apps/test/', call_arg_list[0][0][0].command) - self.assertEquals({'not_if': "su - user1 -c ' hadoop fs -ls /apps/test//*.files' >/dev/null 2>&1", 'user': 'user1', 'bin_dir': '/usr/bin', 'conf_dir': '/etc/hadoop/conf'}, + self.assertEquals({'not_if': "su - user1 -c ' export PATH=$PATH:/usr/bin ; hadoop fs -ls /apps/test//*.files' >/dev/null 2>&1", 'user': 'user1', 'bin_dir': '/usr/bin', 'conf_dir': '/etc/hadoop/conf'}, call_arg_list[0][0][0].arguments) self.assertEquals('fs -chown user1 /apps/test//*.files', call_arg_list[1][0][0].command) self.assertEquals({'user': 'hdfs', 'bin_dir': '/usr/bin', 'conf_dir': '/etc/hadoop/conf'}, call_arg_list[1][0][0].arguments) @@ -57,7 +57,7 @@ class TestCopyFromLocal(TestCase): call_arg_list = execute_hadoop_mock.call_args_list self.assertEqual('fs -copyFromLocal /user/testdir/*.files /apps/test/', call_arg_list[0][0][0].command) - self.assertEquals({'not_if': "su - user1 -c ' hadoop fs -ls /apps/test//*.files' >/dev/null 2>&1", 'user': 'user1', 'bin_dir': '/usr/bin', 'conf_dir': '/etc/hadoop/conf'}, + self.assertEquals({'not_if': "su - user1 -c ' export PATH=$PATH:/usr/bin ; hadoop fs -ls /apps/test//*.files' >/dev/null 2>&1", 'user': 'user1', 'bin_dir': '/usr/bin', 'conf_dir': '/etc/hadoop/conf'}, call_arg_list[0][0][0].arguments) self.assertEquals('fs -chown user1:hdfs /apps/test//*.files', call_arg_list[1][0][0].command) self.assertEquals({'user': 'hdfs', 'bin_dir': '/usr/bin', 'conf_dir': '/etc/hadoop/conf'}, call_arg_list[1][0][0].arguments) http://git-wip-us.apache.org/repos/asf/ambari/blob/0d220839/ambari-common/src/main/python/resource_management/libraries/providers/copy_from_local.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/resource_management/libraries/providers/copy_from_local.py b/ambari-common/src/main/python/resource_management/libraries/providers/copy_from_local.py index ff16e16..19f4669 100644 --- a/ambari-common/src/main/python/resource_management/libraries/providers/copy_from_local.py +++ b/ambari-common/src/main/python/resource_management/libraries/providers/copy_from_local.py @@ -46,7 +46,7 @@ class CopyFromLocalProvider(Provider): dest_path = dest_dir + os.sep + dest_file_name # Need to run unless as resource user su_cmd = 'su - {0} -c'.format(owner) - unless_cmd = format("{su_cmd} '{kinnit_if_needed} hadoop fs -ls {dest_path}' >/dev/null 2>&1") + unless_cmd = format("{su_cmd} '{kinnit_if_needed} export PATH=$PATH:{bin_dir} ; hadoop fs -ls {dest_path}' >/dev/null 2>&1") ExecuteHadoop(copy_cmd, not_if=unless_cmd, http://git-wip-us.apache.org/repos/asf/ambari/blob/0d220839/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/hive_service.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/hive_service.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/hive_service.py index d88d0b0..d5a1785 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/hive_service.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/hive_service.py @@ -49,7 +49,8 @@ def hive_service( Execute(demon_cmd, user=params.hive_user, - environment= {'PATH' : params.execute_path, 'HADOOP_HOME' : params.hadoop_home }, + environment={'HADOOP_HOME': params.hadoop_home}, + path=params.execute_path, not_if=process_id_exists ) http://git-wip-us.apache.org/repos/asf/ambari/blob/0d220839/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py index 9652fb0..e64ffa3 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py @@ -45,7 +45,7 @@ if rpm_version is not None: hive_tar_file = '/usr/hdp/current/hive/hive.tar.gz' hcat_lib = '/usr/hdp/current/hive/hive-hcatalog/share/hcatalog' - webhcat_bin_dir = '/usr/hdp/current/hive/hive-hcatalog/sbin' + webhcat_bin_dir = '/usr/hdp/current/hive-hcatalog/sbin' else: hadoop_bin_dir = "/usr/bin" http://git-wip-us.apache.org/repos/asf/ambari/blob/0d220839/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_metastore.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_metastore.py b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_metastore.py index 1101230..ebf4721 100644 --- a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_metastore.py +++ b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_metastore.py @@ -41,8 +41,8 @@ class TestHiveMetastore(RMFTestCase): self.assert_configure_default() self.assertResourceCalled('Execute', 'env HADOOP_HOME=/usr JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /tmp/start_metastore_script /var/log/hive/hive.out /var/log/hive/hive.log /var/run/hive/hive.pid /etc/hive/conf.server /var/log/hive', not_if = 'ls /var/run/hive/hive.pid >/dev/null 2>&1 && ps `cat /var/run/hive/hive.pid` >/dev/null 2>&1', - environment = {'PATH' : os.environ['PATH'] + os.pathsep + "/usr/lib/hive/bin" + os.pathsep + "/usr/bin", - 'HADOOP_HOME' : '/usr'}, + environment = {'HADOOP_HOME' : '/usr'}, + path = [os.environ['PATH'] + os.pathsep + "/usr/lib/hive/bin" + os.pathsep + "/usr/bin"], user = 'hive', ) self.assertResourceCalled('Execute', '/usr/jdk64/jdk1.7.0_45/bin/java -cp /usr/lib/ambari-agent/DBConnectionVerification.jar:/usr/share/java/mysql-connector-java.jar org.apache.ambari.server.DBConnectionVerification \'jdbc:mysql://c6402.ambari.apache.org/hive?createDatabaseIfNotExist=true\' hive \'!`"\'"\'"\' 1\' com.mysql.jdbc.Driver', @@ -83,8 +83,8 @@ class TestHiveMetastore(RMFTestCase): self.assert_configure_secured() self.assertResourceCalled('Execute', 'env HADOOP_HOME=/usr JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /tmp/start_metastore_script /var/log/hive/hive.out /var/log/hive/hive.log /var/run/hive/hive.pid /etc/hive/conf.server /var/log/hive', not_if = 'ls /var/run/hive/hive.pid >/dev/null 2>&1 && ps `cat /var/run/hive/hive.pid` >/dev/null 2>&1', - environment = {'PATH' : os.environ['PATH'] + os.pathsep + "/usr/lib/hive/bin" + os.pathsep + "/usr/bin", - 'HADOOP_HOME' : '/usr'}, + environment = {'HADOOP_HOME' : '/usr'}, + path = [os.environ['PATH'] + os.pathsep + "/usr/lib/hive/bin" + os.pathsep + "/usr/bin"], user = 'hive', ) self.assertResourceCalled('Execute', '/usr/jdk64/jdk1.7.0_45/bin/java -cp /usr/lib/ambari-agent/DBConnectionVerification.jar:/usr/share/java/mysql-connector-java.jar org.apache.ambari.server.DBConnectionVerification \'jdbc:mysql://c6402.ambari.apache.org/hive?createDatabaseIfNotExist=true\' hive \'!`"\'"\'"\' 1\' com.mysql.jdbc.Driver', http://git-wip-us.apache.org/repos/asf/ambari/blob/0d220839/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py index a72f3ea..7122e7b 100644 --- a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py +++ b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py @@ -102,8 +102,8 @@ class TestHiveServer(RMFTestCase): self.assertResourceCalled('Execute', 'env JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /tmp/start_hiveserver2_script /var/log/hive/hive-server2.out /var/log/hive/hive-server2.log /var/run/hive/hive-server.pid /etc/hive/conf.server /var/log/hive', not_if = 'ls /var/run/hive/hive-server.pid >/dev/null 2>&1 && ps `cat /var/run/hive/hive-server.pid` >/dev/null 2>&1', - environment = {'PATH' : os.environ['PATH'] + os.pathsep + "/usr/lib/hive/bin" + os.pathsep + "/usr/bin", - 'HADOOP_HOME' : '/usr'}, + environment = {'HADOOP_HOME' : '/usr'}, + path = [os.environ['PATH'] + os.pathsep + "/usr/lib/hive/bin" + os.pathsep + "/usr/bin"], user = 'hive' ) @@ -155,8 +155,8 @@ class TestHiveServer(RMFTestCase): self.assert_configure_secured() self.assertResourceCalled('Execute', 'env JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /tmp/start_hiveserver2_script /var/log/hive/hive-server2.out /var/log/hive/hive-server2.log /var/run/hive/hive-server.pid /etc/hive/conf.server /var/log/hive', not_if = 'ls /var/run/hive/hive-server.pid >/dev/null 2>&1 && ps `cat /var/run/hive/hive-server.pid` >/dev/null 2>&1', - environment = {'PATH' : os.environ['PATH'] + os.pathsep + "/usr/lib/hive/bin" + os.pathsep + "/usr/bin", - 'HADOOP_HOME': '/usr'}, + environment = {'HADOOP_HOME' : '/usr'}, + path = [os.environ['PATH'] + os.pathsep + "/usr/lib/hive/bin" + os.pathsep + "/usr/bin"], user = 'hive' ) http://git-wip-us.apache.org/repos/asf/ambari/blob/0d220839/ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py b/ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py index 691c21a..72da429 100644 --- a/ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py +++ b/ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py @@ -41,8 +41,8 @@ class TestHiveMetastore(RMFTestCase): self.assert_configure_default() self.assertResourceCalled('Execute', 'env HADOOP_HOME=/usr JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /tmp/start_metastore_script /var/log/hive/hive.out /var/log/hive/hive.log /var/run/hive/hive.pid /etc/hive/conf.server /var/log/hive', not_if = 'ls /var/run/hive/hive.pid >/dev/null 2>&1 && ps `cat /var/run/hive/hive.pid` >/dev/null 2>&1', - environment = {'PATH' : os.environ['PATH'] + os.pathsep + "/usr/lib/hive/bin" + os.pathsep + "/usr/bin", - 'HADOOP_HOME' : '/usr'}, + environment = {'HADOOP_HOME': '/usr'}, + path = [os.environ['PATH'] + os.pathsep + "/usr/lib/hive/bin" + os.pathsep + "/usr/bin"], user = 'hive' ) @@ -85,8 +85,8 @@ class TestHiveMetastore(RMFTestCase): self.assert_configure_secured() self.assertResourceCalled('Execute', 'env HADOOP_HOME=/usr JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /tmp/start_metastore_script /var/log/hive/hive.out /var/log/hive/hive.log /var/run/hive/hive.pid /etc/hive/conf.server /var/log/hive', not_if = 'ls /var/run/hive/hive.pid >/dev/null 2>&1 && ps `cat /var/run/hive/hive.pid` >/dev/null 2>&1', - environment = {'PATH' : os.environ['PATH'] + os.pathsep + "/usr/lib/hive/bin" + os.pathsep + "/usr/bin", - 'HADOOP_HOME' : '/usr'}, + environment = {'HADOOP_HOME' : '/usr'}, + path = [os.environ['PATH'] + os.pathsep + "/usr/lib/hive/bin" + os.pathsep + "/usr/bin"], user = 'hive' )
