summaryrefslogtreecommitdiffstats
path: root/scripts/show-changed
diff options
context:
space:
mode:
authorSeth Vidal <skvidal@fedoraproject.org>2013-07-04 03:03:58 +0000
committerSeth Vidal <skvidal@fedoraproject.org>2013-07-04 03:03:58 +0000
commit8dc05c6294fa7d3bb94dd11b11c1a9fc2ef09c3d (patch)
treeaff78db7c0dc2993cdf132c531d71c0b9b003d68 /scripts/show-changed
parentcfaddae895ceb6c8f4f2942eccde8e975076cfba (diff)
- add show_changed - python and much faster than the shell
- remove show-changed
Diffstat (limited to 'scripts/show-changed')
-rwxr-xr-xscripts/show-changed83
1 files changed, 0 insertions, 83 deletions
diff --git a/scripts/show-changed b/scripts/show-changed
deleted file mode 100755
index 5e64c5111..000000000
--- a/scripts/show-changed
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/bin/bash
-# view the ansible logs
-# takes all the options of grep and passes them straight through - then parses the output so it looks better and readable
-# should only be used on the .log files not the .info files. info files are flat readable
-# example:
-# show-changed -v today mirrorlist
-
-
-logpath='/var/log/ansible'
-search_terms="CHANGED|FAILED"
-
-
-function search_logs ()
- {
-IFS='
-'
-
-for line in `grep -H -E $search_terms $@`
-do
- logpath=`echo $line| cut -d: -f1`
- hostname=`basename $logpath`
- dir=`dirname $logpath`
- runtime=`basename $dir`
- echo -n "$runtime - $hostname "
- pre=`echo $line | cut -d: -f2-| cut -f3-4`
- json=`echo $line | cut -d: -f2- |cut -f5-`
- echo $json| python -m json.tool 2>/dev/null >&2
- if [ $? != 0 ]; then
- echo "Error parsing json"
- else
- if [ "$verbose" == 'yes' ]; then
- echo $pre
- echo $json| python -m json.tool
- else
- echo -n $pre
- for term in task_userid cmd task_args task_module; do
- res=`echo $json| /srv/web/infra/ansible/scripts/keyreturn $term 2>/dev/null`
- if [ $? == 0 ]; then
- echo -n " $res"
- #$json| /srv/web/infra/ansible/scripts/keyreturn $term
- fi
- done
- echo ''
- fi
- fi
-done
-
-}
-
-while getopts ":v" opt; do
- case $opt in
- v)
- export verbose='yes'
- ;;
- \?)
- echo "Invalid option: -$OPTARG" >&2
- ;;
- esac
-done
-
-shift $(( OPTIND - 1 ));
-
-when='yesterday'
-if [ -n "$1" ]; then
-when=$1
-fi
-
-ts=`date -d "$when" +%Y/%m/%d`
-
-if [ -z "$2" ]; then
- where='*'
-else
- where=$2
-fi
-
-for pb in $logpath/$where/; do
- if [ -d $pb/$ts ]; then
- echo `basename $pb`
- search_logs $pb/$ts/*/*.log
- fi
- done
-
-