summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/Bcfg2/Client/Tools/Portage.py5
-rw-r--r--src/lib/Bcfg2/Client/Tools/__init__.py5
-rw-r--r--src/lib/Bcfg2/Utils.py12
3 files changed, 11 insertions, 11 deletions
diff --git a/src/lib/Bcfg2/Client/Tools/Portage.py b/src/lib/Bcfg2/Client/Tools/Portage.py
index d4373c299..6b38d7dec 100644
--- a/src/lib/Bcfg2/Client/Tools/Portage.py
+++ b/src/lib/Bcfg2/Client/Tools/Portage.py
@@ -29,10 +29,7 @@ class Portage(Bcfg2.Client.Tools.PkgTool):
self._binpkgonly = self.setup.get('portage_binpkgonly', False)
if self._binpkgonly:
self.pkgtool = self._binpkgtool
- try:
- self.RefreshPackages()
- except OSError:
- raise Bcfg2.Client.Tools.ToolInstantiationError("equery not found")
+ self.RefreshPackages()
def RefreshPackages(self):
"""Refresh memory hashes of packages."""
diff --git a/src/lib/Bcfg2/Client/Tools/__init__.py b/src/lib/Bcfg2/Client/Tools/__init__.py
index e87d6e1d9..48fbbed52 100644
--- a/src/lib/Bcfg2/Client/Tools/__init__.py
+++ b/src/lib/Bcfg2/Client/Tools/__init__.py
@@ -561,10 +561,7 @@ class SvcTool(Tool):
:returns: bool - True if the status command returned 0, False
otherwise
"""
- try:
- return bool(self.cmd.run(self.get_svc_command(service, 'status')))
- except OSError:
- return False
+ return self.cmd.run(self.get_svc_command(service, 'status')).success
def Remove(self, services):
if self.setup['servicemode'] != 'disabled':
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: