]> arthur.barton.de Git - netdata.git/commitdiff
better check in ExecutableService
authorpaulfantom <paulfantom@gmail.com>
Fri, 12 Aug 2016 16:54:24 +0000 (18:54 +0200)
committerpaulfantom <paulfantom@gmail.com>
Fri, 12 Aug 2016 16:54:24 +0000 (18:54 +0200)
python.d/python_modules/base.py

index 87c55830c32e3293d0ae1639149c815cb1a0c790..4dad11b69de4728b1bd1024e227dd75ecbf4e68b 100644 (file)
@@ -775,20 +775,20 @@ class ExecutableService(SimpleService):
             self.command = str(self.configuration['command'])
         except (KeyError, TypeError):
             self.error("No command specified. Using: '" + self.command + "'")
-        self.command = self.command.split(' ')
+        command = self.command.split(' ')
 
-        for arg in self.command[1:]:
+        for arg in command[1:]:
             if any(st in arg for st in self.bad_substrings):
                 self.error("Bad command argument:" + " ".join(self.command[1:]))
                 return False
         # test command and search for it in /usr/sbin or /sbin when failed
-        base = self.command[0].split('/')[-1]
+        base = command[0].split('/')[-1]
         if self._get_raw_data() is None:
             for prefix in ['/sbin/', '/usr/sbin/']:
-                self.command[0] = prefix + base
-                if os.path.isfile(self.command[0]):
+                command[0] = prefix + base
+                if os.path.isfile(command[0]):
                     break
-
+        self.command = command
         if self._get_data() is None or len(self._get_data()) == 0:
             self.error("Command", self.command, "returned no data")
             return False