Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: edit.sh

Issue 29761555: #8852 - ldap sync output filter (Closed)
Left Patch Set: Created April 25, 2018, 11:42 a.m.
Right Patch Set: #8852 - ldap sync output filter Created June 20, 2018, 12:32 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | output.txt » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 #!/bin/bash 1 #!/bin/sh
f.lopez 2018/05/04 01:50:54 please use /bin/sh instead of /bin/bash This way
2 2
f.lopez 2018/05/04 01:50:54 What is this script about? What is the intention o
3 IFS=$'\n' lines=($(cat /dev/stdin)) 3 # Filter out uninformative output lines from the ldap-sync cron job script
f.lopez 2018/05/04 01:50:54 you may want to look into doing this with `read(2)
4 4
5 for (( i=0; i < ${#lines[*]}; i++ )) 5 last_action=""
f.lopez 2018/05/04 01:50:54 and while you are looking into the comment above,
6 do 6
7 if [[ ${lines[$i]} != *"Updating"* ]] && [[ ${lines[$i]} != *"Found"* ]] && [[ ${lines[$i]} != *"Synchronizing"* ]] && [[ ${lines[$i]} != "#"* ]]; then 7 while read line; do
f.lopez 2018/05/04 01:50:54 the double square brackets (`[[`) is a bash featur
8 echo ${lines[$i]} 8 case "$line" in
9 elif [[ ${lines[$i]} == *"Updating"* ]] && [[ ${lines[$i+1]} == *"->"* ]]; the n 9 *-\>*)
10 echo ${lines[$i]} 10 if [ ! -z "$last_action" ]
11 fi 11 then
12 echo "$last_action"
13 fi
14
15 echo "$line"
16 last_action=""
17 ;;
18 --\ Found\ *\ users* | \
19 \#* | \
20 *Synchronizing\ *\ groups* | \
21 \*\*\ Synchronizing\ *\ users* | \
22 --\ Updating\ user\ \'*\'?\(*\)* | \
23 --\ Updating\ group\ \'*\'* | \
24 --\ Creating\ user\ \'*\'?\(*\)* | \
25 --\ Creating\ group\ \'*\'*)
26 last_action="$line"
27 ;;
28 *)
29 echo "$line"
30 ;;
31 esac
12 done 32 done
LEFTRIGHT
« no previous file | output.txt » ('j') | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld