diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-03-22 09:05:16 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-03-22 09:05:16 -0400 |
commit | a906ebbd96cf3a022b489cc2c6aa1136e3c35af2 (patch) | |
tree | 8ddfaa0fac79771e928faef64d975d6061d97931 /src/lib/Bcfg2/Utils.py | |
parent | 9444a7f8e7f304b05a979675d2e9b2c71757f9d2 (diff) | |
download | bcfg2-a906ebbd96cf3a022b489cc2c6aa1136e3c35af2.tar.gz bcfg2-a906ebbd96cf3a022b489cc2c6aa1136e3c35af2.tar.bz2 bcfg2-a906ebbd96cf3a022b489cc2c6aa1136e3c35af2.zip |
Executor: handle missing commands in a more backwards-compatible way
Diffstat (limited to 'src/lib/Bcfg2/Utils.py')
-rw-r--r-- | src/lib/Bcfg2/Utils.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lib/Bcfg2/Utils.py b/src/lib/Bcfg2/Utils.py index 4e2deb92e..33da8bd71 100644 --- a/src/lib/Bcfg2/Utils.py +++ b/src/lib/Bcfg2/Utils.py @@ -202,9 +202,15 @@ class Executor(object): else: cmdstr = " ".join(command) self.logger.debug("Running: %s" % cmdstr) - proc = subprocess.Popen(command, shell=shell, bufsize=16384, - stdin=subprocess.PIPE, stdout=subprocess.PIPE, - stderr=subprocess.PIPE, close_fds=True) + try: + proc = subprocess.Popen(command, shell=shell, bufsize=16384, + close_fds=True, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + except OSError: + return ExecutorResult('', 'No such command: %s' % cmdstr, + 127) if timeout is None: timeout = self.timeout if timeout is not None: |