ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject ambari git commit: AMBARI-8957. Non-root install: Ganglia Monitor Install issue (aonishuk)
Date Tue, 30 Dec 2014 15:00:44 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk e8e1e3402 -> b4c48c262


AMBARI-8957. Non-root install: Ganglia Monitor Install issue (aonishuk)


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

Branch: refs/heads/trunk
Commit: b4c48c262fe0b0cfadcae5be8d2860eecff9d1cf
Parents: e8e1e34
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Tue Dec 30 17:00:39 2014 +0200
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Tue Dec 30 17:00:39 2014 +0200

----------------------------------------------------------------------
 .../TestMonitorWebserverResource.py             | 20 ++++++++------------
 .../libraries/providers/monitor_webserver.py    | 14 ++++++++++----
 .../GANGLIA/3.5.0/package/files/setupGanglia.sh | 18 +++++++++++-------
 .../GANGLIA/3.5.0/package/scripts/functions.py  | 19 +++++++++++++------
 .../package/scripts/ganglia_monitor_service.py  |  5 ++---
 .../3.5.0/package/scripts/ganglia_server.py     |  4 +++-
 .../package/scripts/ganglia_server_service.py   |  4 ++--
 .../3.5.0/package/templates/gangliaLib.sh.j2    |  3 ++-
 .../2.0.6/GANGLIA/test_ganglia_monitor.py       | 14 ++++++++------
 .../stacks/2.0.6/GANGLIA/test_ganglia_server.py | 16 +++++++++-------
 10 files changed, 68 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b4c48c26/ambari-agent/src/test/python/resource_management/TestMonitorWebserverResource.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestMonitorWebserverResource.py
b/ambari-agent/src/test/python/resource_management/TestMonitorWebserverResource.py
index 533ecaa..65ada42 100644
--- a/ambari-agent/src/test/python/resource_management/TestMonitorWebserverResource.py
+++ b/ambari-agent/src/test/python/resource_management/TestMonitorWebserverResource.py
@@ -31,11 +31,9 @@ class TestMonitorWebserverResource(TestCase):
     with Environment(test_mode=True) as env:
       MonitorWebserverProvider(MonitorWebserver("start")).action_start()
     defined_resources = env.resource_list
-    expected_resources = "[MonitorWebserver['start'], " \
-                         "Execute['grep -E 'KeepAlive (On|Off)' /etc/httpd/conf/httpd.conf"
\
-                         " && sed -i 's/KeepAlive Off/KeepAlive On/' /etc/httpd/conf/httpd.conf"
\
-                         " || echo 'KeepAlive On' >> /etc/httpd/conf/httpd.conf'],"
\
-                         " Execute['/etc/init.d/httpd start']]"
+    expected_resources = "[MonitorWebserver['start'], Execute['grep -E 'KeepAlive (On|Off)'
/etc/httpd/conf/httpd.conf && " \
+    "/usr/bin/sudo [RMF_ENV_PLACEHOLDER] -H -E sed -i 's/KeepAlive Off/KeepAlive On/' /etc/httpd/conf/httpd.conf
|| " \
+    "echo 'KeepAlive On' | /usr/bin/sudo [RMF_ENV_PLACEHOLDER] -H -E tee --append /etc/httpd/conf/httpd.conf
> /dev/null'], Execute['('/etc/init.d/httpd', 'start')']]"
     self.assertEqual(str(defined_resources), expected_resources)
 
   @patch.object(System, "os_family", new='suse')
@@ -43,11 +41,9 @@ class TestMonitorWebserverResource(TestCase):
     with Environment(test_mode=True) as env:
       MonitorWebserverProvider(MonitorWebserver("start")).action_start()
     defined_resources = env.resource_list
-    expected_resources = "[MonitorWebserver['start'], " \
-                         "Execute['grep -E 'KeepAlive (On|Off)' /etc/apache2/httpd.conf "
\
-                         "&& sed -i 's/KeepAlive Off/KeepAlive On/' /etc/apache2/httpd.conf
" \
-                         "|| echo 'KeepAlive On' >> /etc/apache2/httpd.conf']," \
-                         " Execute['/etc/init.d/apache2 start']]"
+    expected_resources = "[MonitorWebserver['start'], Execute['grep -E 'KeepAlive (On|Off)'
/etc/apache2/httpd.conf && /usr/bin/sudo [RMF_ENV_PLACEHOLDER] " \
+    "-H -E sed -i 's/KeepAlive Off/KeepAlive On/' /etc/apache2/httpd.conf || echo 'KeepAlive
On' | " \
+    "/usr/bin/sudo [RMF_ENV_PLACEHOLDER] -H -E tee --append /etc/apache2/httpd.conf >
/dev/null'], Execute['('/etc/init.d/apache2', 'start')']]"
     self.assertEqual(str(defined_resources), expected_resources)
 
   @patch.object(System, "os_family", new='redhat')
@@ -56,7 +52,7 @@ class TestMonitorWebserverResource(TestCase):
       MonitorWebserverProvider(MonitorWebserver("stop")).action_stop()
     defined_resources = env.resource_list
     expected_resources = "[MonitorWebserver['stop'], " \
-                         "Execute['/etc/init.d/httpd stop']]"
+                         "Execute['('/etc/init.d/httpd', 'stop')']]"
     self.assertEqual(str(defined_resources), expected_resources)
 
   @patch.object(System, "os_family", new='suse')
@@ -65,5 +61,5 @@ class TestMonitorWebserverResource(TestCase):
       MonitorWebserverProvider(MonitorWebserver("stop")).action_stop()
     defined_resources = env.resource_list
     expected_resources = "[MonitorWebserver['stop'], " \
-                         "Execute['/etc/init.d/apache2 stop']]"
+                         "Execute['('/etc/init.d/apache2', 'stop')']]"
     self.assertEqual(str(defined_resources), expected_resources)

http://git-wip-us.apache.org/repos/asf/ambari/blob/b4c48c26/ambari-common/src/main/python/resource_management/libraries/providers/monitor_webserver.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/providers/monitor_webserver.py
b/ambari-common/src/main/python/resource_management/libraries/providers/monitor_webserver.py
index 3a053ab..7d2c1e1 100644
--- a/ambari-common/src/main/python/resource_management/libraries/providers/monitor_webserver.py
+++ b/ambari-common/src/main/python/resource_management/libraries/providers/monitor_webserver.py
@@ -29,12 +29,16 @@ class MonitorWebserverProvider(Provider):
     self.get_serivice_params()
     self.enable_keep_alive()
     service_name = self.service_name
-    Execute(format("/etc/init.d/{service_name} start"))
+    Execute((format('/etc/init.d/{service_name}'), 'start'),
+      sudo = True,        
+    )
 
   def action_stop(self):
     self.get_serivice_params()
     service_name = self.service_name
-    Execute(format("/etc/init.d/{service_name} stop"))
+    Execute((format('/etc/init.d/{service_name}'), 'stop'),
+      sudo = True,        
+    )
 
   def action_restart(self):
     self.action_stop()
@@ -49,7 +53,9 @@ class MonitorWebserverProvider(Provider):
       self.service_name = "httpd"
       self.httpd_conf_dir = '/etc/httpd/conf'
 
+  # "tee --append /etc/apt/sources.list > /dev/null"
   def enable_keep_alive(self):
     httpd_conf_dir = self.httpd_conf_dir
-    Execute(format(
-      "grep -E 'KeepAlive (On|Off)' {httpd_conf_dir}/httpd.conf && sed -i 's/KeepAlive
Off/KeepAlive On/' {httpd_conf_dir}/httpd.conf || echo 'KeepAlive On' >> {httpd_conf_dir}/httpd.conf"))
+    command = format("grep -E 'KeepAlive (On|Off)' {httpd_conf_dir}/httpd.conf &&
" + as_sudo(('sed',  '-i','s/KeepAlive Off/KeepAlive On/', format("{httpd_conf_dir}/httpd.conf")))
+ " || echo 'KeepAlive On' | ") + as_sudo(('tee', '--append', format('{httpd_conf_dir}/httpd.conf')))
+ " > /dev/null" 
+    Execute(command
+    )

http://git-wip-us.apache.org/repos/asf/ambari/blob/b4c48c26/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/files/setupGanglia.sh
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/files/setupGanglia.sh
b/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/files/setupGanglia.sh
index 704766e..b5b6762 100644
--- a/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/files/setupGanglia.sh
+++ b/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/files/setupGanglia.sh
@@ -46,7 +46,8 @@ function instantiateGmetadConf()
   # gmetad utility library.
   source ./gmetadLib.sh;
 
-  generateGmetadConf > ${GMETAD_CONF_FILE};
+  generateGmetadConf > ${TMP_GANGLIA_FILE};
+  sudo -H -E cp ${TMP_GANGLIA_FILE} ${GMETAD_CONF_FILE}
 }
 
 function instantiateGmondConf()
@@ -63,19 +64,22 @@ function instantiateGmondConf()
     createDirectory "${GANGLIA_CONF_DIR}/${gmondClusterName}/conf.d";
     
     # Always blindly generate the core gmond config - that goes on every box running gmond.

-    generateGmondCoreConf ${gmondClusterName} > `getGmondCoreConfFileName ${gmondClusterName}`;
+    generateGmondCoreConf ${gmondClusterName} > ${TMP_GANGLIA_FILE};
+    sudo -H -E cp ${TMP_GANGLIA_FILE} `getGmondCoreConfFileName ${gmondClusterName}`;
 
     isMasterGmond=${2};
 
     # Decide whether we want to add on the master or slave gmond config.
     if [ "0" -eq "${isMasterGmond}" ]
     then
-      generateGmondSlaveConf ${gmondClusterName} > `getGmondSlaveConfFileName ${gmondClusterName}`;
+      generateGmondSlaveConf ${gmondClusterName} > ${TMP_GANGLIA_FILE};
+      sudo -H -E cp ${TMP_GANGLIA_FILE} `getGmondSlaveConfFileName ${gmondClusterName}`;
     else
-      generateGmondMasterConf ${gmondClusterName} > `getGmondMasterConfFileName ${gmondClusterName}`;
+      generateGmondMasterConf ${gmondClusterName} > ${TMP_GANGLIA_FILE}
+      sudo -H -E cp ${TMP_GANGLIA_FILE} `getGmondMasterConfFileName ${gmondClusterName}`;
     fi
 
-    chown -R ${3}:${4} ${GANGLIA_CONF_DIR}/${gmondClusterName}
+    sudo -H -E chown -R ${3}:${4} ${GANGLIA_CONF_DIR}/${gmondClusterName}
 
   else
     echo "No gmondClusterName passed in, nothing to instantiate";
@@ -118,8 +122,8 @@ done
 createDirectory ${GANGLIA_CONF_DIR};
 createDirectory ${GANGLIA_RUNTIME_DIR};
 # So rrdcached can drop its PID files in here.
-chmod -R o+rw ${GANGLIA_RUNTIME_DIR};
-chown ${owner}:${group} ${GANGLIA_CONF_DIR};
+sudo -H -E chmod -R o+rw ${GANGLIA_RUNTIME_DIR};
+sudo -H -E chown ${owner}:${group} ${GANGLIA_CONF_DIR};
 
 if [ -n "${gmondClusterName}" ]
 then

http://git-wip-us.apache.org/repos/asf/ambari/blob/b4c48c26/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/functions.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/functions.py
b/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/functions.py
index b02e688..0f20f17 100644
--- a/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/functions.py
+++ b/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/functions.py
@@ -20,12 +20,19 @@ from resource_management import *
 
 def turn_off_autostart(service):
   if System.get_instance().os_family == "ubuntu":
-    Execute(format("update-rc.d {service} disable"),
-            path='/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'
+    Execute(('update-rc.d', service, 'disable'),
+            path='/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin',
+            sudo = True
+    )
+    Execute(('service', service, 'stop'),
+            sudo = True,
+            ignore_failures=True,
+    )
+    File(format('/etc/init/{service}.override'), # disable upstart job
+         content = 'manual',
     )
-    Execute(format("service {service} stop"), ignore_failures=True)
-    Execute(format("echo 'manual' > /etc/init/{service}.override")) # disbale upstart
job
   else:
-    Execute(format("chkconfig {service} off"),
-            path='/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'
+    Execute(('chkconfig', service, 'off'),
+            path='/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin',
+            sudo = True,
     )

http://git-wip-us.apache.org/repos/asf/ambari/blob/b4c48c26/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/ganglia_monitor_service.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/ganglia_monitor_service.py
b/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/ganglia_monitor_service.py
index cf7a4b1..58d512c 100644
--- a/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/ganglia_monitor_service.py
+++ b/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/ganglia_monitor_service.py
@@ -20,8 +20,7 @@ from resource_management import *
 
 
 def monitor(action=None):# 'start' or 'stop'
-  Execute(
-    format(
-      "service hdp-gmond {action} >> /tmp/gmond.log  2>&1 ; /bin/ps auwx | /bin/grep
[g]mond  >> /tmp/gmond.log  2>&1"),
+  service_start_command = as_sudo(('service', 'hdp-gmond', action))
+  Execute(format("{service_start_command} >> /tmp/gmond.log  2>&1 ; /bin/ps
auwx | /bin/grep [g]mond  >> /tmp/gmond.log  2>&1"),
     path='/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'
   )

http://git-wip-us.apache.org/repos/asf/ambari/blob/b4c48c26/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/ganglia_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/ganglia_server.py
b/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/ganglia_server.py
index 3492fff..5bbb545 100644
--- a/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/ganglia_server.py
+++ b/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/ganglia_server.py
@@ -88,7 +88,9 @@ def change_permission():
             mode=0755,
             recursive=True
   )
-  Execute(format("chown -R {web_user} {dwoo_path}"))
+  Execute(('chown', '-R', params.web_user, params.dwoo_path),
+          sudo = True,
+  )
 
 def server_files():
   import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/b4c48c26/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/ganglia_server_service.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/ganglia_server_service.py
b/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/ganglia_server_service.py
index b93e3f8..70fdbf6 100644
--- a/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/ganglia_server_service.py
+++ b/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/scripts/ganglia_server_service.py
@@ -20,8 +20,8 @@ from resource_management import *
 
 
 def server(action=None):# 'start' or 'stop'
-  command = "service hdp-gmetad {action} >> /tmp/gmetad.log  2>&1 ; /bin/ps
auwx | /bin/grep [g]metad  >> /tmp/gmetad.log  2>&1"
-  Execute(format(command),
+  command = as_sudo(('service', 'hdp-gmetad', action)) + " >> /tmp/gmetad.log  2>&1
; /bin/ps auwx | /bin/grep [g]metad  >> /tmp/gmetad.log  2>&1"
+  Execute(command,
           path='/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'
   )
   MonitorWebserver("restart")

http://git-wip-us.apache.org/repos/asf/ambari/blob/b4c48c26/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/templates/gangliaLib.sh.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/templates/gangliaLib.sh.j2
b/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/templates/gangliaLib.sh.j2
index 6c24c7f..9d62ef6 100644
--- a/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/templates/gangliaLib.sh.j2
+++ b/ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/package/templates/gangliaLib.sh.j2
@@ -46,6 +46,7 @@ RRDCACHED_WRITE_THREADS={{rrdcached_write_threads}}
 RRDCACHED_TIMEOUT={{rrdcached_timeout}}
 RRDCACHED_FLUSH_TIMEOUT={{rrdcached_flush_timeout}}
 RRDCACHED_DELAY={{rrdcached_delay}}
+TMP_GANGLIA_FILE="/tmp/ganglia_tmp_file"
 
 # This file contains all the info about each Ganglia Cluster in our Grid.
 GANGLIA_CLUSTERS_CONF_FILE=./gangliaClusters.conf;
@@ -56,7 +57,7 @@ function createDirectory()
 
     if [ "x" != "x${directoryPath}" ]
     then
-        mkdir -p ${directoryPath};
+        sudo -H -E mkdir -p ${directoryPath};
     fi
 }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b4c48c26/ambari-server/src/test/python/stacks/2.0.6/GANGLIA/test_ganglia_monitor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/GANGLIA/test_ganglia_monitor.py b/ambari-server/src/test/python/stacks/2.0.6/GANGLIA/test_ganglia_monitor.py
index 67b88ca..cc15126 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/GANGLIA/test_ganglia_monitor.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/GANGLIA/test_ganglia_monitor.py
@@ -60,7 +60,7 @@ class TestGangliaMonitor(RMFTestCase):
     )
     self.assert_configure_default()
     self.assert_gmond_master_conf_generated()
-    self.assertResourceCalled('Execute', 'service hdp-gmond start >> /tmp/gmond.log
 2>&1 ; /bin/ps auwx | /bin/grep [g]mond  >> /tmp/gmond.log  2>&1',
+    self.assertResourceCalled('Execute', '/usr/bin/sudo [RMF_ENV_PLACEHOLDER] -H -E service
hdp-gmond start >> /tmp/gmond.log  2>&1 ; /bin/ps auwx | /bin/grep [g]mond  >>
/tmp/gmond.log  2>&1',
         path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
     )
     self.assertNoMoreResources()
@@ -74,9 +74,9 @@ class TestGangliaMonitor(RMFTestCase):
                        hdp_stack_version = self.STACK_VERSION,
                        target = RMFTestCase.TARGET_COMMON_SERVICES
     )
-    self.assertResourceCalled('Execute', 'service hdp-gmond stop >> /tmp/gmond.log
 2>&1 ; /bin/ps auwx | /bin/grep [g]mond  >> /tmp/gmond.log  2>&1',
-                              path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
-                              )
+    self.assertResourceCalled('Execute', '/usr/bin/sudo [RMF_ENV_PLACEHOLDER] -H -E service
hdp-gmond stop >> /tmp/gmond.log  2>&1 ; /bin/ps auwx | /bin/grep [g]mond  >>
/tmp/gmond.log  2>&1',
+        path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+    )
     self.assertNoMoreResources()
 
 
@@ -90,11 +90,13 @@ class TestGangliaMonitor(RMFTestCase):
     )
     self.assert_configure_default()
     self.assert_gmond_master_conf_generated()
-    self.assertResourceCalled('Execute', 'chkconfig gmond off',
+    self.assertResourceCalled('Execute', ('chkconfig', 'gmond', 'off'),
         path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+        sudo = True,
     )
-    self.assertResourceCalled('Execute', 'chkconfig gmetad off',
+    self.assertResourceCalled('Execute', ('chkconfig', 'gmetad', 'off'),
         path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+        sudo = True,
     )
     self.assertNoMoreResources()
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b4c48c26/ambari-server/src/test/python/stacks/2.0.6/GANGLIA/test_ganglia_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/GANGLIA/test_ganglia_server.py b/ambari-server/src/test/python/stacks/2.0.6/GANGLIA/test_ganglia_server.py
index 470fcc7..cfe788d 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/GANGLIA/test_ganglia_server.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/GANGLIA/test_ganglia_server.py
@@ -45,9 +45,9 @@ class TestGangliaServer(RMFTestCase):
                        target = RMFTestCase.TARGET_COMMON_SERVICES
     )
     self.assert_configure_default()
-    self.assertResourceCalled('Execute', 'service hdp-gmetad start >> /tmp/gmetad.log
 2>&1 ; /bin/ps auwx | /bin/grep [g]metad  >> /tmp/gmetad.log  2>&1',
-                              path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
-                              )
+    self.assertResourceCalled('Execute', '/usr/bin/sudo [RMF_ENV_PLACEHOLDER] -H -E service
hdp-gmetad start >> /tmp/gmetad.log  2>&1 ; /bin/ps auwx | /bin/grep [g]metad
 >> /tmp/gmetad.log  2>&1',
+        path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+    )
     self.assertResourceCalled('MonitorWebserver', 'restart',
                               )
     self.assertNoMoreResources()
@@ -60,9 +60,9 @@ class TestGangliaServer(RMFTestCase):
                        hdp_stack_version = self.STACK_VERSION,
                        target = RMFTestCase.TARGET_COMMON_SERVICES
     )
-    self.assertResourceCalled('Execute', 'service hdp-gmetad stop >> /tmp/gmetad.log
 2>&1 ; /bin/ps auwx | /bin/grep [g]metad  >> /tmp/gmetad.log  2>&1',
-                              path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
-                              )
+    self.assertResourceCalled('Execute', '/usr/bin/sudo [RMF_ENV_PLACEHOLDER] -H -E service
hdp-gmetad stop >> /tmp/gmetad.log  2>&1 ; /bin/ps auwx | /bin/grep [g]metad
 >> /tmp/gmetad.log  2>&1',
+        path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+    )
     self.assertResourceCalled('MonitorWebserver', 'restart',
                               )
     self.assertNoMoreResources()
@@ -176,7 +176,9 @@ class TestGangliaServer(RMFTestCase):
         recursive = True,
         mode = 0755,
     )
-    self.assertResourceCalled('Execute', 'chown -R wwwrun /var/lib/ganglia-web/dwoo',)
+    self.assertResourceCalled('Execute', ('chown', '-R', 'wwwrun', '/var/lib/ganglia-web/dwoo'),
+        sudo = True,
+    )
     self.assertResourceCalled('Directory', '/srv/www/cgi-bin',
         recursive = True,
     )


Mime
View raw message