From f6e3a85a0abc8fc0de5a6f2be5c65e60dbcc690a Mon Sep 17 00:00:00 2001
From: Seth Vidal <skvidal@fedoraproject.org>
Date: Wed, 3 Jul 2013 22:54:16 +0000
Subject: [PATCH] make show-changed show better

---
 scripts/keyreturn    | 7 +++++--
 scripts/show-changed | 8 ++++++--
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/scripts/keyreturn b/scripts/keyreturn
index d711ad3a4c..5a28ba6743 100755
--- a/scripts/keyreturn
+++ b/scripts/keyreturn
@@ -11,6 +11,7 @@ import sys
 def main():
    infile = sys.stdin
    obj = json.load(infile)
+   ret = 0
    for name in sys.argv[1:]:
        if type(obj) != dict:
            print >> sys.stderr, "No dict found"
@@ -19,7 +20,9 @@ def main():
            print '%s: %s' % (name, obj.get(name, None))
        else:
            print >> sys.stderr, "No key %s found" % name
-      
+           ret = 1
+   return ret      
+   
 if __name__ == '__main__':
-    main()
+    sys.exit(main())
            
\ No newline at end of file
diff --git a/scripts/show-changed b/scripts/show-changed
index cddc5616ab..e073e2f7c2 100755
--- a/scripts/show-changed
+++ b/scripts/show-changed
@@ -31,8 +31,12 @@ do
     if [ "$verbose" == 'yes' ]; then
       echo $json| python -m json.tool
     else
-      echo $json| /srv/web/infra/ansible/scripts/keyreturn task_userid
-      echo $json| /srv/web/infra/ansible/scripts/keyreturn cmd
+      for term in task_userid cmd task_args task_module; do
+         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
 done