diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-11-22 09:48:45 -0500 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-12-09 07:39:10 -0500 |
commit | eff366a0c3b9ba87f3ee06f90dccdd242579b7b1 (patch) | |
tree | ec318841d5802391d9e6c14f5494df30ee90e83f /src/lib/Bcfg2/Server/Plugins/Packages/Yum.py | |
parent | 43d0820d3b86395fd65bbf20c66d54b4fac425eb (diff) | |
download | bcfg2-eff366a0c3b9ba87f3ee06f90dccdd242579b7b1.tar.gz bcfg2-eff366a0c3b9ba87f3ee06f90dccdd242579b7b1.tar.bz2 bcfg2-eff366a0c3b9ba87f3ee06f90dccdd242579b7b1.zip |
Packages: better way to find bcfg2-yum-helper
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins/Packages/Yum.py')
-rw-r--r-- | src/lib/Bcfg2/Server/Plugins/Packages/Yum.py | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py b/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py index b98d3f419..6a493c19d 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/Yum.py @@ -63,6 +63,7 @@ import Bcfg2.Server.Plugin import Bcfg2.Server.FileMonitor from lockfile import FileLock from Bcfg2.Utils import Executor +from distutils.spawn import find_executable # pylint: disable=W0622 from Bcfg2.Compat import StringIO, cPickle, HTTPError, URLError, \ ConfigParser, any @@ -340,22 +341,18 @@ class YumCollection(Collection): @property def helper(self): - """ The full path to :file:`bcfg2-yum-helper`. First, we - check in the config file to see if it has been explicitly - specified; next we see if it's in $PATH (which we do by making - a call to it; I wish there was a way to do this without - forking, but apparently not); finally we check in /usr/sbin, - the default location. """ + """The full path to :file:`bcfg2-yum-helper`. First, we check in the + config file to see if it has been explicitly specified; next + we see if it's in $PATH; finally we default to /usr/sbin, the + default location. """ if not self._helper: # pylint: disable=W0212 self.__class__._helper = Bcfg2.Options.setup.yum_helper if not self.__class__._helper: # first see if bcfg2-yum-helper is in PATH - try: - self.debug_log("Checking for bcfg2-yum-helper in $PATH") - self.cmd.run(['bcfg2-yum-helper']) - self.__class__._helper = 'bcfg2-yum-helper' - except OSError: + self.debug_log("Checking for bcfg2-yum-helper in $PATH") + self.__class__._helper = find_executable('bcfg2-yum-helper') + if not self.__class__._helper: self.__class__._helper = "/usr/sbin/bcfg2-yum-helper" # pylint: enable=W0212 return self._helper |