diff options
author | Jeff Willette <jrwillette88@gmail.com> | 2016-12-13 08:04:23 +0900 |
---|---|---|
committer | Jeff Willette <jrwillette88@gmail.com> | 2016-12-13 08:04:23 +0900 |
commit | d6c9b19c6c9ebe2ef7af7f2d03beb92891ee7844 (patch) | |
tree | 2e0c281af9c0c7a360604a3a9743e591e46f624e /python.d | |
parent | 24eed0717deeaeaa963796fd4875b94b6024c6d3 (diff) |
Changed ExecutableService check() to split properly
ExectuableService was splitting the command in the wrong place
which was causing it to only be searched in /sbin and /usr/sbin
instead of the regular PATH.
Diffstat (limited to 'python.d')
-rw-r--r-- | python.d/python_modules/base.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/python.d/python_modules/base.py b/python.d/python_modules/base.py index dd86e29544..320c54bae3 100644 --- a/python.d/python_modules/base.py +++ b/python.d/python_modules/base.py @@ -868,22 +868,22 @@ class ExecutableService(SimpleService): self.command = str(self.configuration['command']) except (KeyError, TypeError): self.info("No command specified. Using: '" + self.command + "'") - command = self.command.split(' ') + # Splitting self.command on every space so subprocess.Popen reads it properly + self.command = self.command.split(' ') - for arg in command[1:]: + for arg in self.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 = command[0].split('/')[-1] + base = self.command[0].split('/')[-1] if self._get_raw_data() is None: for prefix in ['/sbin/', '/usr/sbin/']: - command[0] = prefix + base - if os.path.isfile(command[0]): + self.command[0] = prefix + base + if os.path.isfile(self.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 |