|
|
|
@ -31,8 +31,33 @@ import subprocess
|
|
|
|
|
# to a dictionary
|
|
|
|
|
# FIXME: make more idiomatic
|
|
|
|
|
|
|
|
|
|
args = " ".join(sys.argv[1:])
|
|
|
|
|
items = shlex.split(args)
|
|
|
|
|
|
|
|
|
|
if len(sys.argv) == 1:
|
|
|
|
|
print json.dumps({
|
|
|
|
|
"failed" : True,
|
|
|
|
|
"msg" : "the command module requires arguments (-a)"
|
|
|
|
|
})
|
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
argfile = sys.argv[1]
|
|
|
|
|
if not os.path.exists(argfile):
|
|
|
|
|
print json.dumps({
|
|
|
|
|
"failed" : True,
|
|
|
|
|
"msg" : "Argument file not found"
|
|
|
|
|
})
|
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
args = open(argfile, 'r').read()
|
|
|
|
|
itmes = shlex.split(args)
|
|
|
|
|
|
|
|
|
|
if not len(items):
|
|
|
|
|
print json.dumps({
|
|
|
|
|
"failed" : True,
|
|
|
|
|
"msg" : "the command module requires arguments (-a)"
|
|
|
|
|
})
|
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
params = {}
|
|
|
|
|
for x in items:
|
|
|
|
|
(k, v) = x.split("=")
|
|
|
|
|