You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dm...@apache.org on 2014/10/20 20:02:03 UTC
[5/8] git commit: AMBARI-7864. HiveServer2 doesn't start from Ambari
when hive authorization is true (dlysnichenko)
AMBARI-7864. HiveServer2 doesn't start from Ambari when hive authorization is true (dlysnichenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3d1787b3
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3d1787b3
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3d1787b3
Branch: refs/heads/trunk
Commit: 3d1787b338cf94072b14128233eb2fd28ccefb82
Parents: f145b5a
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Mon Oct 20 21:00:29 2014 +0300
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Mon Oct 20 21:00:29 2014 +0300
----------------------------------------------------------------------
.../2.0.6/services/HIVE/package/scripts/hive_service.py | 4 ++--
.../test/python/stacks/2.0.6/HIVE/test_hive_server.py | 11 ++++++++---
2 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/3d1787b3/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 5463df4..294121d 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
@@ -97,10 +97,10 @@ def hive_service(
def check_fs_root():
import params
fs_root_url = format("{fs_root}{hive_apps_whs_dir}")
- cmd = format("metatool -listFSRoot 2>/dev/null | grep hdfs://")
+ cmd = format("metatool -listFSRoot 2>/dev/null | grep hdfs:// | grep -v '.db$'")
code, out = call(cmd, user=params.hive_user)
if code == 0 and fs_root_url.strip() != out.strip():
cmd = format("metatool -updateLocation {fs_root}{hive_apps_whs_dir} {out}")
Execute(cmd,
environment= {'PATH' : params.execute_path },
- user=params.hive_user)
\ No newline at end of file
+ user=params.hive_user)
http://git-wip-us.apache.org/repos/asf/ambari/blob/3d1787b3/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 ed759ac..f0f1675 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
@@ -18,6 +18,7 @@ See the License for the specific language governing permissions and
limitations under the License.
'''
import os
+import subprocess
from mock.mock import MagicMock, call, patch
from stacks.utils.RMFTestCase import *
@@ -34,9 +35,9 @@ class TestHiveServer(RMFTestCase):
self.assert_configure_default()
self.assertNoMoreResources()
- @patch("hive_service.check_fs_root")
+ @patch.object(subprocess,"Popen")
@patch("socket.socket")
- def test_start_default(self, socket_mock, check_fs_root_mock):
+ def test_start_default(self, socket_mock, popen_mock):
s = socket_mock.return_value
self.executeScript("2.0.6/services/HIVE/package/scripts/hive_server.py",
@@ -112,7 +113,11 @@ class TestHiveServer(RMFTestCase):
)
self.assertNoMoreResources()
- self.assertTrue(check_fs_root_mock.called)
+ self.assertTrue(popen_mock.called)
+ popen_mock.assert_called_with(
+ ['su', '-s', '/bin/bash', '-', u'hive', '-c', "metatool -listFSRoot 2>/dev/null | grep hdfs:// | grep -v '.db$'"],
+ shell=False, preexec_fn=None, stderr=-2, stdout=-1, env=None, cwd=None
+ )
self.assertTrue(socket_mock.called)
self.assertTrue(s.close.called)