You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sw...@apache.org on 2013/08/08 23:33:17 UTC

git commit: AMBARI-2847. Restart service component fails if pid is reallocated. (swagle)

Updated Branches:
  refs/heads/trunk 84ea23232 -> 0bc3050f4


AMBARI-2847. Restart service component fails if pid is reallocated. (swagle)


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

Branch: refs/heads/trunk
Commit: 0bc3050f4640c011a3543c0e6ad8c7e579757127
Parents: 84ea232
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Thu Aug 8 14:32:44 2013 -0700
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Thu Aug 8 14:32:44 2013 -0700

----------------------------------------------------------------------
 .../src/main/puppet/modules/hdp-hadoop/manifests/service.pp      | 4 ++--
 .../src/main/puppet/modules/hdp-hbase/manifests/service.pp       | 2 +-
 .../src/main/puppet/modules/hdp-hive/manifests/service.pp        | 2 +-
 .../src/main/puppet/modules/hdp-nagios/manifests/params.pp       | 1 +
 .../src/main/puppet/modules/hdp-nagios/manifests/server.pp       | 4 ++--
 .../src/main/puppet/modules/hdp-nagios/templates/nagios.cfg.erb  | 2 +-
 .../src/main/puppet/modules/hdp-nagios/templates/nagios.erb      | 2 +-
 .../src/main/puppet/modules/hdp-oozie/manifests/service.pp       | 2 +-
 .../src/main/puppet/modules/hdp-templeton/manifests/service.pp   | 2 +-
 .../src/main/puppet/modules/hdp-yarn/manifests/service.pp        | 4 ++--
 .../src/main/puppet/modules/hdp-zookeeper/manifests/service.pp   | 2 +-
 11 files changed, 14 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0bc3050f/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/service.pp
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/service.pp b/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/service.pp
index 208b008..321e21a 100644
--- a/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/service.pp
+++ b/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/service.pp
@@ -60,9 +60,9 @@ define hdp-hadoop::service(
     $service_is_up = "ls ${pid_file} >/dev/null 2>&1 && ps `cat ${pid_file}` >/dev/null 2>&1"
   } elsif ($ensure == 'stopped') {
     if ($run_as_root == true) {
-      $daemon_cmd = "su - root -c  '${cmd} stop ${name}'"
+      $daemon_cmd = "su - root -c  '${cmd} stop ${name}' && rm -f ${pid_file}"
     } else {
-      $daemon_cmd = "su - ${user} -c  '${cmd} stop ${name}'"
+      $daemon_cmd = "su - ${user} -c  '${cmd} stop ${name}' && rm -f ${pid_file}"
     }
     $service_is_up = undef
   } else {

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0bc3050f/ambari-agent/src/main/puppet/modules/hdp-hbase/manifests/service.pp
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/puppet/modules/hdp-hbase/manifests/service.pp b/ambari-agent/src/main/puppet/modules/hdp-hbase/manifests/service.pp
index c1145f3..111438d 100644
--- a/ambari-agent/src/main/puppet/modules/hdp-hbase/manifests/service.pp
+++ b/ambari-agent/src/main/puppet/modules/hdp-hbase/manifests/service.pp
@@ -39,7 +39,7 @@ define hdp-hbase::service(
     $daemon_cmd = "su - ${user} -c  '${cmd} start ${role}'"
     $no_op_test = "ls ${pid_file} >/dev/null 2>&1 && ps `cat ${pid_file}` >/dev/null 2>&1"
   } elsif ($ensure == 'stopped') {
-    $daemon_cmd = "su - ${user} -c  '${cmd} stop ${role}'"
+    $daemon_cmd = "su - ${user} -c  '${cmd} stop ${role}' && rm -f ${pid_file}"
     $no_op_test = undef
   } else {
     $daemon_cmd = undef

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0bc3050f/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/service.pp
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/service.pp b/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/service.pp
index 5edc9a0..038fdbb 100644
--- a/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/service.pp
+++ b/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/service.pp
@@ -55,7 +55,7 @@ class hdp-hive::service(
   if ($ensure == 'running') {
     $daemon_cmd = "su - ${user} -c  '${cmd} '"
   } elsif ($ensure == 'stopped') {
-    $daemon_cmd = "kill `cat $pid_file` >/dev/null 2>&1"
+    $daemon_cmd = "kill `cat $pid_file` >/dev/null 2>&1 && rm -f ${pid_file}"
   } else {
     $daemon_cmd = undef
   }

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0bc3050f/ambari-agent/src/main/puppet/modules/hdp-nagios/manifests/params.pp
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/puppet/modules/hdp-nagios/manifests/params.pp b/ambari-agent/src/main/puppet/modules/hdp-nagios/manifests/params.pp
index 66bdf2e..b9dbf37 100644
--- a/ambari-agent/src/main/puppet/modules/hdp-nagios/manifests/params.pp
+++ b/ambari-agent/src/main/puppet/modules/hdp-nagios/manifests/params.pp
@@ -43,6 +43,7 @@ class hdp-nagios::params() inherits hdp::params
   $plugins_dir = "/usr/lib64/nagios/plugins"
   $eventhandlers_dir = "/usr/lib/nagios/eventhandlers"  # Does not exist yet
   $nagios_pid_dir = "/var/run/nagios"
+  $nagios_pid_file = "${nagios_pid_dir}/nagios.pid"
   $nagios_log_dir = '/var/log/nagios'
   $nagios_log_archives_dir = "${nagios_log_dir}/archives"
   

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0bc3050f/ambari-agent/src/main/puppet/modules/hdp-nagios/manifests/server.pp
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/puppet/modules/hdp-nagios/manifests/server.pp b/ambari-agent/src/main/puppet/modules/hdp-nagios/manifests/server.pp
index 70516f9..b91870e 100644
--- a/ambari-agent/src/main/puppet/modules/hdp-nagios/manifests/server.pp
+++ b/ambari-agent/src/main/puppet/modules/hdp-nagios/manifests/server.pp
@@ -29,7 +29,7 @@ class hdp-nagios::server(
   $nagios_obj_dir = $hdp-nagios::params::nagios_obj_dir
   $check_result_path = $hdp-nagios::params::check_result_path
   $nagios_httpd_config_file = $hdp-nagios::params::httpd_conf_file
-
+  $pid_file = $hdp-nagios::params::nagios_pid_file
 
   if hdp_is_empty($hdp::params::pathes[nagios_p1_pl]) {
     hdp_fail("There is no path to p1.pl file for nagios")
@@ -274,7 +274,7 @@ class hdp-nagios::server::services($ensure)
    if ($ensure == 'running') {
      $command = "service nagios start"
    } elsif ($ensure == 'stopped') {
-     $command = "service nagios stop"
+     $command = "service nagios stop && rm -f ${pid_file}"
    }
 
    if ($ensure in ['running','stopped']) {

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0bc3050f/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/nagios.cfg.erb
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/nagios.cfg.erb b/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/nagios.cfg.erb
index 36c2087..d5b6a7b 100644
--- a/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/nagios.cfg.erb
+++ b/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/nagios.cfg.erb
@@ -215,7 +215,7 @@ external_command_buffer_slots=4096
 # This is the lockfile that Nagios will use to store its PID number
 # in when it is running in daemon mode.
 
-lock_file=/var/run/nagios/nagios.pid
+lock_file=<%=scope.function_hdp_template_var("nagios_pid_file")%>
 
 
 

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0bc3050f/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/nagios.erb
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/nagios.erb b/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/nagios.erb
index 295db23..6497534 100644
--- a/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/nagios.erb
+++ b/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/nagios.erb
@@ -46,7 +46,7 @@ exec_prefix="/usr"
 exec="/usr/sbin/nagios"
 prog="nagios"
 config="/etc/nagios/nagios.cfg"
-pidfile="/var/nagios/nagios.pid"
+pidfile="<%=scope.function_hdp_template_var("nagios_pid_file")%>"
 user="<%=scope.function_hdp_template_var("nagios_user")%>"
 
 [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0bc3050f/ambari-agent/src/main/puppet/modules/hdp-oozie/manifests/service.pp
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/puppet/modules/hdp-oozie/manifests/service.pp b/ambari-agent/src/main/puppet/modules/hdp-oozie/manifests/service.pp
index 6189225..433f328 100644
--- a/ambari-agent/src/main/puppet/modules/hdp-oozie/manifests/service.pp
+++ b/ambari-agent/src/main/puppet/modules/hdp-oozie/manifests/service.pp
@@ -117,7 +117,7 @@ class hdp-oozie::service(
     $start_cmd = "su - ${user} -c  'cd ${oozie_tmp} && /usr/lib/oozie/bin/oozie-start.sh'"
     $no_op_test = "ls ${pid_file} >/dev/null 2>&1 && ps `cat ${pid_file}` >/dev/null 2>&1"
   } elsif ($ensure == 'stopped') {
-    $stop_cmd  = "su - ${user} -c  'cd ${oozie_tmp} && /usr/lib/oozie/bin/oozie-stop.sh'"
+    $stop_cmd  = "su - ${user} -c  'cd ${oozie_tmp} && /usr/lib/oozie/bin/oozie-stop.sh' && rm -f ${pid_file}"
     $no_op_test = "ls ${pid_file} >/dev/null 2>&1 && ps `cat ${pid_file}` >/dev/null 2>&1"
   } else {
     $daemon_cmd = undef

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0bc3050f/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/service.pp
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/service.pp b/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/service.pp
index a2d08ff..ceb3db0 100644
--- a/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/service.pp
+++ b/ambari-agent/src/main/puppet/modules/hdp-templeton/manifests/service.pp
@@ -34,7 +34,7 @@ class hdp-templeton::service(
     $daemon_cmd = "su - ${user} -c  '${cmd} start'"
     $no_op_test = "ls ${pid_file} >/dev/null 2>&1 && ps `cat ${pid_file}` >/dev/null 2>&1"
   } elsif ($ensure == 'stopped') {
-    $daemon_cmd = "su - ${user} -c  '${cmd} stop'"
+    $daemon_cmd = "su - ${user} -c  '${cmd} stop' && rm -f ${pid_file}"
     $no_op_test = undef
   } else {
     $daemon_cmd = undef

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0bc3050f/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/service.pp
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/service.pp b/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/service.pp
index ab0f2ec..507e120 100644
--- a/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/service.pp
+++ b/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/service.pp
@@ -59,9 +59,9 @@ define hdp-yarn::service(
     $service_is_up = "ls ${pid_file} >/dev/null 2>&1 && ps `cat ${pid_file}` >/dev/null 2>&1"
   } elsif ($ensure == 'stopped') {
     if ($run_as_root == true) {
-      $daemon_cmd = "${cmd} stop ${name}"
+      $daemon_cmd = "${cmd} stop ${name} && rm -f ${pid_file}"
     } else {
-      $daemon_cmd = "su - ${user} -c  '${cmd} stop ${name}'"
+      $daemon_cmd = "su - ${user} -c  '${cmd} stop ${name}' && rm -f ${pid_file}"
     }
     $service_is_up = undef
   } else {

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0bc3050f/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/service.pp
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/service.pp b/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/service.pp
index 6a67517..0456520 100644
--- a/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/service.pp
+++ b/ambari-agent/src/main/puppet/modules/hdp-zookeeper/manifests/service.pp
@@ -36,7 +36,7 @@ class hdp-zookeeper::service(
     $no_op_test = "ls ${pid_file} >/dev/null 2>&1 && ps `cat ${pid_file}` >/dev/null 2>&1"
     #not using $no_op_test = "su - ${user} -c  '${cmd} status'" because checks more than whether there is a service started up
   } elsif ($ensure == 'stopped') {
-    $daemon_cmd = "su - ${user} -c  'source ${conf_dir}/zookeeper-env.sh ; ${cmd} stop'"
+    $daemon_cmd = "su - ${user} -c  'source ${conf_dir}/zookeeper-env.sh ; ${cmd} stop' && rm -f ${pid_file}"
     #TODO: put in no_op_test for stopped
     $no_op_test = undef
   } else {