add SmartOS datasource supporting Joyent cloud
This adds a datasource designed to work on Joyent cloud (SmartOS).
This commit is contained in:
@@ -1751,3 +1751,22 @@ def get_mount_info(path, log=LOG):
|
||||
mountinfo_path = '/proc/%s/mountinfo' % os.getpid()
|
||||
lines = load_file(mountinfo_path).splitlines()
|
||||
return parse_mount_info(path, lines, log)
|
||||
|
||||
|
||||
def which(program):
|
||||
# Return path of program for execution if found in path
|
||||
def is_exe(fpath):
|
||||
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
|
||||
|
||||
_fpath, _ = os.path.split(program)
|
||||
if _fpath:
|
||||
if is_exe(program):
|
||||
return program
|
||||
else:
|
||||
for path in os.environ["PATH"].split(os.pathsep):
|
||||
path = path.strip('"')
|
||||
exe_file = os.path.join(path, program)
|
||||
if is_exe(exe_file):
|
||||
return exe_file
|
||||
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user