|
|
@ -37,8 +37,31 @@ import subprocess
|
|
|
|
# to a dictionary
|
|
|
|
# to a dictionary
|
|
|
|
# FIXME: make more idiomatic
|
|
|
|
# FIXME: make more idiomatic
|
|
|
|
|
|
|
|
|
|
|
|
args = " ".join(sys.argv[1:])
|
|
|
|
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()
|
|
|
|
items = shlex.split(args)
|
|
|
|
items = shlex.split(args)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not len(items):
|
|
|
|
|
|
|
|
print json.dumps({
|
|
|
|
|
|
|
|
"failed" : True,
|
|
|
|
|
|
|
|
"msg" : "the command module requires arguments (-a)"
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
|
|
params = {}
|
|
|
|
params = {}
|
|
|
|
for x in items:
|
|
|
|
for x in items:
|
|
|
|
(k, v) = x.split("=")
|
|
|
|
(k, v) = x.split("=")
|
|
|
|