15 |
import string |
import string |
16 |
|
|
17 |
try: |
try: |
18 |
opts, args = getopt.getopt(sys.argv[1:], "h:i:", |
opts, args = getopt.getopt(sys.argv[1:], "h:i:k:", |
19 |
["host=","input="]) |
["host=","input=","keyfile="]) |
20 |
except getopt.GetoptError: |
except getopt.GetoptError: |
21 |
# print help information and exit: |
# print help information and exit: |
22 |
print sys.argv[0] + ": error parsing command line: " + \ |
print sys.argv[0] + ": error parsing command line: " + \ |
26 |
|
|
27 |
schedhost = None |
schedhost = None |
28 |
infile = None |
infile = None |
29 |
|
keyarg = None |
30 |
|
|
31 |
for o, a in opts: |
for o, a in opts: |
32 |
if o in ("-h", "--host"): |
if o in ("-h", "--host"): |
33 |
schedhost = a |
schedhost = a |
34 |
elif o in ("-i", "--input"): |
elif o in ("-i", "--input"): |
35 |
infile = a |
infile = a |
36 |
|
elif o in ("-k", "--keyfile"): |
37 |
|
keyarg = a |
38 |
|
|
39 |
if infile: |
if infile: |
40 |
cmd = '/bin/cat ' + infile |
cmd = '/bin/cat ' + infile |
42 |
cmd = 'diagnose -g' |
cmd = 'diagnose -g' |
43 |
if schedhost: |
if schedhost: |
44 |
cmd = cmd + ' --host=' + schedhost |
cmd = cmd + ' --host=' + schedhost |
45 |
|
if keyarg: |
46 |
|
cmd = cmd + ' --keyfile=' + keyarg |
47 |
|
|
48 |
import commands |
import commands |
49 |
(stat, out) = commands.getstatusoutput(cmd) |
(stat, out) = commands.getstatusoutput(cmd) |