Просмотр исходного кода

AMBARI-1826. Use service stop and start for Nagios/Ganglia/MySQL rather than puppet artifacts for starting stopping these services. (smohanty)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1465152 13f79535-47bb-0310-9956-ffa450edef68
Sumit Mohanty 12 лет назад
Родитель
Сommit
73075b5487

+ 3 - 0
CHANGES.txt

@@ -560,6 +560,9 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-1826. Use service stop and start for Nagios/Ganglia/MySQL rather than
+ puppet artifacts for starting stopping these services. (smohanty)
+
  AMBARI-1818. HBase master shuts down immediately after start in a secure 
  cluster. (swagle)
 

+ 18 - 10
ambari-agent/src/main/puppet/modules/hdp-mysql/manifests/server.pp

@@ -79,19 +79,27 @@ class hdp-mysql::server(
       default =>  'stopped',
     }
 
+    if ($mysqld_state == 'running') {
+      $command = "service $service_name start"
+    } else {
+      $command = "service $service_name stop"
+    }
+
     if ($hdp::params::hdp_os_type == "suse") {
-      service {$service_name:
-        ensure => $mysqld_state,
+      exec { $service_name:
+        command => $command,
+        path    => "/usr/local/bin/:/bin/:/sbin/",
         require => File['/var/run/mysqld/mysqld.pid'],
         notify  => File['/tmp/addMysqlUser.sh']
-      }
-    } else {
-        service {$service_name:
-        ensure => $mysqld_state,
+       }
+     } else {
+      exec { $service_name:
+        command => $command,
+        path    => "/usr/local/bin/:/bin/:/sbin/", 
         require => Hdp::Package['mysql'],
         notify  => File['/tmp/addMysqlUser.sh']
-      }
-    }
+       }
+     }
 
 
     if ($service_state == 'installed_and_configured') {
@@ -100,7 +108,7 @@ class hdp-mysql::server(
         ensure => present,
         source => "puppet:///modules/hdp-mysql/addMysqlUser.sh",
         mode => '0755',
-        require => Service[$service_name],
+        require => Exec[$service_name],
         notify => Exec['/tmp/addMysqlUser.sh'],
       }
       # We start the DB and add a user
@@ -117,7 +125,7 @@ class hdp-mysql::server(
       # Now MySQL is running so we remove the temporary file
       file {'/tmp/addMysqlUser.sh':
         ensure => absent,
-        require => Service[$service_name],
+        require => Exec[$service_name],
         notify => Anchor['hdp-mysql::server::end'],
       }
     }

+ 13 - 4
ambari-agent/src/main/puppet/modules/hdp-nagios/manifests/server.pp

@@ -227,10 +227,19 @@ class hdp-nagios::server::web_permisssions()
 
 class hdp-nagios::server::services($ensure)
 {
-  if ($ensure in ['running','stopped']) {
-    service { 'nagios': ensure => $ensure}
-    anchor{'hdp-nagios::server::services::begin':} ->  Service['nagios'] ->  anchor{'hdp-nagios::server::services::end':}
-  }
+   if ($ensure == 'running') {
+     $command = "service nagios start"
+   } elsif ($ensure == 'stopped') {
+     $command = "service nagios stop"
+   }
+
+   if ($ensure in ['running','stopped']) {
+     exec { "nagios":
+       command => $command,
+       path    => "/usr/local/bin/:/bin/:/sbin/",      
+     }
+     anchor{'hdp-nagios::server::services::begin':} ->  Exec['nagios'] ->  anchor{'hdp-nagios::server::services::end':}	
+   }
 }
 
 class hdp-nagios::server::enable_snmp() {