From 0c6651331d3a8fc867a1799b18baed4c0789ba69 Mon Sep 17 00:00:00 2001 From: Shubhendu Tripathi Date: Tue, 6 May 2014 14:39:42 +0530 Subject: nagios-server-addons: NRPE command with timeout Introduced a utility method to return a NRPE base command with timeout set externally. Currently if a plugin internally executes NRPE to get the details from the node, there is no mechanism that timeout could be set to more than 10 sec. This method provides the NRPE command with timeout (if passed). This is required for some of the NRPE calls where gluster commands get executed and they might take more time. All the plugins, which execute a NRPE within, can provide optional command line argument for timeout, and same can be used for forming the proper NRPE call with timeout value. Change-Id: Id97624df743664a320a585acc4a85cfcf64d0a07 Signed-off-by: Shubhendu Tripathi Reviewed-on: http://review.gluster.org/7682 Reviewed-by: Sahina Bose Tested-by: Sahina Bose --- tests/test_discovery.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/test_discovery.py b/tests/test_discovery.py index 5e03732..a3d1347 100644 --- a/tests/test_discovery.py +++ b/tests/test_discovery.py @@ -16,14 +16,14 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # -from plugins import discovery +from plugins import discovery, server_utils from glusternagios.glustercli import HostStatus from testrunner import PluginsTestCase as TestCaseBase class TestDiscovery(TestCaseBase): def _mockExecNRPECommand(self, host, command, arguments=None, - jsonOutput=True): + timeout=None): if command == "discover_volume_list": return self._getVolumeNames() elif command == "discover_volume_info": @@ -96,8 +96,10 @@ class TestDiscovery(TestCaseBase): # Method to test the discoverCluster() method def testDiscoverCluster(self): - discovery.execNRPECommand = self._mockExecNRPECommand + server_utils.execNRPECommand = self._mockExecNRPECommand clusterName = "test-cluster" host = "172.16.53.1" - clusterdata = discovery.discoverCluster(host, clusterName) + clusterdata = discovery.discoverCluster(host, + clusterName, + timeout=None) self._verifyClusterData(clusterdata, clusterName, host) -- cgit