root / image_creator / util.py @ 9297c398
History | View | Annotate | Download (524 Bytes)
1 |
#!/usr/bin/env python
|
---|---|
2 |
|
3 |
import pbs |
4 |
|
5 |
def get_command(command): |
6 |
def find_sbin_command(command, exception): |
7 |
search_paths = ['/usr/local/sbin', '/usr/sbin', '/sbin'] |
8 |
for fullpath in map(lambda x: "%s/%s" % (x, command), search_paths): |
9 |
if os.path.exists(fullpath) and os.access(fullpath, os.X_OK): |
10 |
return pbs.Command(fullpath)
|
11 |
raise exception
|
12 |
|
13 |
try:
|
14 |
return pbs.__getattr__(command)
|
15 |
except pbs.CommadNotFount as e: |
16 |
return find_sbin_command(command, e)
|