make show-changed show better
This commit is contained in:
parent
1efa8496d5
commit
f6e3a85a0a
2 changed files with 11 additions and 4 deletions
|
@ -11,6 +11,7 @@ import sys
|
||||||
def main():
|
def main():
|
||||||
infile = sys.stdin
|
infile = sys.stdin
|
||||||
obj = json.load(infile)
|
obj = json.load(infile)
|
||||||
|
ret = 0
|
||||||
for name in sys.argv[1:]:
|
for name in sys.argv[1:]:
|
||||||
if type(obj) != dict:
|
if type(obj) != dict:
|
||||||
print >> sys.stderr, "No dict found"
|
print >> sys.stderr, "No dict found"
|
||||||
|
@ -19,7 +20,9 @@ def main():
|
||||||
print '%s: %s' % (name, obj.get(name, None))
|
print '%s: %s' % (name, obj.get(name, None))
|
||||||
else:
|
else:
|
||||||
print >> sys.stderr, "No key %s found" % name
|
print >> sys.stderr, "No key %s found" % name
|
||||||
|
ret = 1
|
||||||
|
return ret
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
sys.exit(main())
|
||||||
|
|
|
@ -31,8 +31,12 @@ do
|
||||||
if [ "$verbose" == 'yes' ]; then
|
if [ "$verbose" == 'yes' ]; then
|
||||||
echo $json| python -m json.tool
|
echo $json| python -m json.tool
|
||||||
else
|
else
|
||||||
echo $json| /srv/web/infra/ansible/scripts/keyreturn task_userid
|
for term in task_userid cmd task_args task_module; do
|
||||||
echo $json| /srv/web/infra/ansible/scripts/keyreturn cmd
|
echo $json| /srv/web/infra/ansible/scripts/keyreturn $term 2>/dev/null >&2
|
||||||
|
if [ $? == 0 ]; then
|
||||||
|
echo $json| /srv/web/infra/ansible/scripts/keyreturn $term
|
||||||
|
fi
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue