@@ -328,13 +328,18 @@ def get_by_id(self, id):
328328 return None
329329
330330
331- def which (exe = None ):
331+ def which (exe = None ,
332+ default_paths = [
333+ '/bin' , '/sbin' , '/usr/bin' , '/usr/sbin' , '/usr/local/bin' ]
334+ ):
332335 """Return path of bin. Python clone of /usr/bin/which.
333336
334337 from salt.util - https://www.github.com/saltstack/salt - license apache
335338
336339 :param exe: Application to search PATHs for.
337340 :type exe: string
341+ :param default_path: Application to search PATHs for.
342+ :type default_path: list
338343 :rtype: string
339344
340345 """
@@ -352,17 +357,15 @@ def _is_executable_file_or_link(exe):
352357 # win' for cases to find optional alternatives
353358 search_path = os .environ .get ('PATH' ) and \
354359 os .environ ['PATH' ].split (os .pathsep ) or list ()
355- for default_path in [
356- '/bin' , '/sbin' , '/usr/bin' , '/usr/sbin' , '/usr/local/bin'
357- ]:
360+ for default_path in default_paths :
358361 if default_path not in search_path :
359362 search_path .append (default_path )
360363 os .environ ['PATH' ] = os .pathsep .join (search_path )
361364 for path in search_path :
362365 full_path = os .path .join (path , exe )
363366 if _is_executable_file_or_link (full_path ):
364367 return full_path
365- logger .trace (
368+ logger .info (
366369 '\' {0}\' could not be found in the following search path: '
367370 '\' {1}\' ' .format (exe , search_path ))
368371
0 commit comments