Repository: ambari
Updated Branches:
  refs/heads/trunk b946b63f2 -> 0e8baccec


AMBARI-5697. When restart hive service from Ambari webUI, it fails with the 
error: cat: /var/run/hive/hive.pid: No such file or directory (aonishuk)


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

Branch: refs/heads/trunk
Commit: 0e8baccec36f5694ec812f9ea00a7ad6ad8858d3
Parents: b946b63
Author: Andrew Onishuk <[email protected]>
Authored: Wed May 7 18:09:18 2014 +0300
Committer: Andrew Onishuk <[email protected]>
Committed: Wed May 7 18:53:21 2014 +0300

----------------------------------------------------------------------
 .../services/HIVE/package/scripts/hive_service.py     | 14 ++++++++++----
 .../services/HIVE/package/scripts/hive_service.py     | 10 +++++++---
 .../python/stacks/1.3.2/HIVE/test_hive_metastore.py   |  8 ++++++--
 .../test/python/stacks/1.3.2/HIVE/test_hive_server.py |  8 ++++++--
 .../python/stacks/2.0.6/HIVE/test_hive_metastore.py   |  8 ++++++--
 .../test/python/stacks/2.0.6/HIVE/test_hive_server.py |  8 ++++++--
 .../python/stacks/2.1/HIVE/test_hive_metastore.py     |  8 ++++++--
 7 files changed, 47 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0e8bacce/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/package/scripts/hive_service.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/package/scripts/hive_service.py
 
b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/package/scripts/hive_service.py
index 70a300d..568f6ec 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/package/scripts/hive_service.py
+++ 
b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/package/scripts/hive_service.py
@@ -36,12 +36,14 @@ def hive_service(
     cmd = format(
       "env JAVA_HOME={java64_home} {start_hiveserver2_path} 
{hive_log_dir}/hive-server2.out {hive_log_dir}/hive-server2.log {pid_file} 
{hive_server_conf_dir} {hive_log_dir}")
 
+  is_started = format("ls {pid_file} >/dev/null 2>&1 && ps `cat {pid_file}` 
>/dev/null 2>&1")
+  
   if action == 'start':
     demon_cmd = format("{cmd}")
-    no_op_test = format("ls {pid_file} >/dev/null 2>&1 && ps `cat {pid_file}` 
>/dev/null 2>&1")
+    
     Execute(demon_cmd,
             user=params.hive_user,
-            not_if=no_op_test
+            not_if=is_started
     )
 
     if params.hive_jdbc_driver == "com.mysql.jdbc.Driver" or \
@@ -50,9 +52,13 @@ def hive_service(
       db_connection_check_command = format(
         "{java64_home}/bin/java -cp 
{check_db_connection_jar}:/usr/share/java/{jdbc_jar_name} 
org.apache.ambari.server.DBConnectionVerification {hive_jdbc_connection_url} 
{hive_metastore_user_name} {hive_metastore_user_passwd!p} {hive_jdbc_driver}")
       Execute(db_connection_check_command,
-              path='/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin')
+              path='/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin',
+      )
 
   elif action == 'stop':
     demon_cmd = format("kill `cat {pid_file}` >/dev/null 2>&1 && rm -f 
{pid_file}")
-    Execute(demon_cmd)
+    Execute(demon_cmd,
+            not_if = format("! ({is_started})")
+    )
+
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/0e8bacce/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 70a300d..596eec9 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
@@ -36,12 +36,14 @@ def hive_service(
     cmd = format(
       "env JAVA_HOME={java64_home} {start_hiveserver2_path} 
{hive_log_dir}/hive-server2.out {hive_log_dir}/hive-server2.log {pid_file} 
{hive_server_conf_dir} {hive_log_dir}")
 
+  is_started = format("ls {pid_file} >/dev/null 2>&1 && ps `cat {pid_file}` 
>/dev/null 2>&1")
+  
   if action == 'start':
     demon_cmd = format("{cmd}")
-    no_op_test = format("ls {pid_file} >/dev/null 2>&1 && ps `cat {pid_file}` 
>/dev/null 2>&1")
+    
     Execute(demon_cmd,
             user=params.hive_user,
-            not_if=no_op_test
+            not_if=is_started
     )
 
     if params.hive_jdbc_driver == "com.mysql.jdbc.Driver" or \
@@ -54,5 +56,7 @@ def hive_service(
 
   elif action == 'stop':
     demon_cmd = format("kill `cat {pid_file}` >/dev/null 2>&1 && rm -f 
{pid_file}")
-    Execute(demon_cmd)
+    Execute(demon_cmd,
+            not_if = format("! ({is_started})")
+    )
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/0e8bacce/ambari-server/src/test/python/stacks/1.3.2/HIVE/test_hive_metastore.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/python/stacks/1.3.2/HIVE/test_hive_metastore.py 
b/ambari-server/src/test/python/stacks/1.3.2/HIVE/test_hive_metastore.py
index 5a1b061..3914844 100644
--- a/ambari-server/src/test/python/stacks/1.3.2/HIVE/test_hive_metastore.py
+++ b/ambari-server/src/test/python/stacks/1.3.2/HIVE/test_hive_metastore.py
@@ -85,7 +85,9 @@ class TestHiveMetastore(RMFTestCase):
                        config_file="default.json"
     )
 
-    self.assertResourceCalled('Execute', 'kill `cat /var/run/hive/hive.pid` 
>/dev/null 2>&1 && rm -f /var/run/hive/hive.pid')
+    self.assertResourceCalled('Execute', 'kill `cat /var/run/hive/hive.pid` 
>/dev/null 2>&1 && rm -f /var/run/hive/hive.pid',
+                              not_if = '! (ls /var/run/hive/hive.pid 
>/dev/null 2>&1 && ps `cat /var/run/hive/hive.pid` >/dev/null 2>&1)'
+    )
     self.assertNoMoreResources()
 
   def test_configure_secured(self):
@@ -151,7 +153,9 @@ class TestHiveMetastore(RMFTestCase):
                        config_file="secured.json"
     )
 
-    self.assertResourceCalled('Execute', 'kill `cat /var/run/hive/hive.pid` 
>/dev/null 2>&1 && rm -f /var/run/hive/hive.pid')
+    self.assertResourceCalled('Execute', 'kill `cat /var/run/hive/hive.pid` 
>/dev/null 2>&1 && rm -f /var/run/hive/hive.pid',
+                              not_if = '! (ls /var/run/hive/hive.pid 
>/dev/null 2>&1 && ps `cat /var/run/hive/hive.pid` >/dev/null 2>&1)'
+    )
     self.assertNoMoreResources()
 
   def assert_configure_default(self):

http://git-wip-us.apache.org/repos/asf/ambari/blob/0e8bacce/ambari-server/src/test/python/stacks/1.3.2/HIVE/test_hive_server.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/python/stacks/1.3.2/HIVE/test_hive_server.py 
b/ambari-server/src/test/python/stacks/1.3.2/HIVE/test_hive_server.py
index 1b77b0b..f5997e4 100644
--- a/ambari-server/src/test/python/stacks/1.3.2/HIVE/test_hive_server.py
+++ b/ambari-server/src/test/python/stacks/1.3.2/HIVE/test_hive_server.py
@@ -85,7 +85,9 @@ class TestHiveServer(RMFTestCase):
                        config_file="default.json"
     )
 
-    self.assertResourceCalled('Execute', 'kill `cat 
/var/run/hive/hive-server.pid` >/dev/null 2>&1 && rm -f 
/var/run/hive/hive-server.pid')
+    self.assertResourceCalled('Execute', 'kill `cat 
/var/run/hive/hive-server.pid` >/dev/null 2>&1 && rm -f 
/var/run/hive/hive-server.pid',
+                              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)'
+    )
     self.assertNoMoreResources()
 
     
@@ -152,7 +154,9 @@ class TestHiveServer(RMFTestCase):
                        config_file="secured.json"
     )
 
-    self.assertResourceCalled('Execute', 'kill `cat 
/var/run/hive/hive-server.pid` >/dev/null 2>&1 && rm -f 
/var/run/hive/hive-server.pid')
+    self.assertResourceCalled('Execute', 'kill `cat 
/var/run/hive/hive-server.pid` >/dev/null 2>&1 && rm -f 
/var/run/hive/hive-server.pid',
+                              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)'
+    )
     self.assertNoMoreResources()
 
   def assert_configure_default(self):

http://git-wip-us.apache.org/repos/asf/ambari/blob/0e8bacce/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 f5148ff..61ef4b5 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
@@ -70,7 +70,9 @@ class TestHiveMetastore(RMFTestCase):
                        config_file="default.json"
     )
 
-    self.assertResourceCalled('Execute', 'kill `cat /var/run/hive/hive.pid` 
>/dev/null 2>&1 && rm -f /var/run/hive/hive.pid')
+    self.assertResourceCalled('Execute', 'kill `cat /var/run/hive/hive.pid` 
>/dev/null 2>&1 && rm -f /var/run/hive/hive.pid',
+                              not_if = '! (ls /var/run/hive/hive.pid 
>/dev/null 2>&1 && ps `cat /var/run/hive/hive.pid` >/dev/null 2>&1)'
+    )
     self.assertNoMoreResources()
 
   def test_configure_secured(self):
@@ -136,7 +138,9 @@ class TestHiveMetastore(RMFTestCase):
                        config_file="secured.json"
     )
 
-    self.assertResourceCalled('Execute', 'kill `cat /var/run/hive/hive.pid` 
>/dev/null 2>&1 && rm -f /var/run/hive/hive.pid')
+    self.assertResourceCalled('Execute', 'kill `cat /var/run/hive/hive.pid` 
>/dev/null 2>&1 && rm -f /var/run/hive/hive.pid',
+                              not_if = '! (ls /var/run/hive/hive.pid 
>/dev/null 2>&1 && ps `cat /var/run/hive/hive.pid` >/dev/null 2>&1)'
+    )
     self.assertNoMoreResources()
 
   def assert_configure_default(self):

http://git-wip-us.apache.org/repos/asf/ambari/blob/0e8bacce/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 d2a0390..c056591 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
@@ -132,7 +132,9 @@ class TestHiveServer(RMFTestCase):
                        config_file="default.json"
     )
 
-    self.assertResourceCalled('Execute', 'kill `cat 
/var/run/hive/hive-server.pid` >/dev/null 2>&1 && rm -f 
/var/run/hive/hive-server.pid')
+    self.assertResourceCalled('Execute', 'kill `cat 
/var/run/hive/hive-server.pid` >/dev/null 2>&1 && rm -f 
/var/run/hive/hive-server.pid',
+                              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)'
+    )
     self.assertNoMoreResources()
 
     
@@ -199,7 +201,9 @@ class TestHiveServer(RMFTestCase):
                        config_file="secured.json"
     )
 
-    self.assertResourceCalled('Execute', 'kill `cat 
/var/run/hive/hive-server.pid` >/dev/null 2>&1 && rm -f 
/var/run/hive/hive-server.pid')
+    self.assertResourceCalled('Execute', 'kill `cat 
/var/run/hive/hive-server.pid` >/dev/null 2>&1 && rm -f 
/var/run/hive/hive-server.pid',
+                              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)'
+    )
     self.assertNoMoreResources()
 
   def assert_configure_default(self):

http://git-wip-us.apache.org/repos/asf/ambari/blob/0e8bacce/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 111d8b3..0f1ad88 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
@@ -56,7 +56,9 @@ class TestHiveMetastore(RMFTestCase):
                        config_file="../../2.1/configs/default.json"
     )
 
-    self.assertResourceCalled('Execute', 'kill `cat /var/run/hive/hive.pid` 
>/dev/null 2>&1 && rm -f /var/run/hive/hive.pid')
+    self.assertResourceCalled('Execute', 'kill `cat /var/run/hive/hive.pid` 
>/dev/null 2>&1 && rm -f /var/run/hive/hive.pid',
+                              not_if = '! (ls /var/run/hive/hive.pid 
>/dev/null 2>&1 && ps `cat /var/run/hive/hive.pid` >/dev/null 2>&1)'
+    )
     self.assertNoMoreResources()
 
   def test_configure_secured(self):
@@ -94,7 +96,9 @@ class TestHiveMetastore(RMFTestCase):
                        config_file="../../2.1/configs/secured.json"
     )
 
-    self.assertResourceCalled('Execute', 'kill `cat /var/run/hive/hive.pid` 
>/dev/null 2>&1 && rm -f /var/run/hive/hive.pid')
+    self.assertResourceCalled('Execute', 'kill `cat /var/run/hive/hive.pid` 
>/dev/null 2>&1 && rm -f /var/run/hive/hive.pid',
+                              not_if = '! (ls /var/run/hive/hive.pid 
>/dev/null 2>&1 && ps `cat /var/run/hive/hive.pid` >/dev/null 2>&1)'
+    )
     self.assertNoMoreResources()
 
   def assert_configure_default(self):

Reply via email to