Revision 240c2f10 snf-image-host/common.sh.in
b/snf-image-host/common.sh.in | ||
---|---|---|
43 | 43 |
} |
44 | 44 |
|
45 | 45 |
log_error() { |
46 |
ERROR_MSGS+=("$@") |
|
47 |
echo "$*" >&2 |
|
46 |
echo "[ERROR] $*" >&2 |
|
48 | 47 |
} |
49 | 48 |
|
49 |
report_error() { |
|
50 |
ERROR_MSGS+=("$@") |
|
51 |
} |
|
50 | 52 |
|
51 |
log_info() {
|
|
52 |
echo "$*" >&2 |
|
53 |
report_info() {
|
|
54 |
echo "[INFO] $*" >&2
|
|
53 | 55 |
|
54 | 56 |
local report="$(./host-monitor.py info <<< "$*")" |
55 | 57 |
|
... | ... | |
62 | 64 |
exec {fd}>&- |
63 | 65 |
} |
64 | 66 |
|
65 |
report_error() { |
|
66 |
local error_file=$1 |
|
67 |
send_errors() { |
|
67 | 68 |
local report="" |
68 | 69 |
if [ ${#ERROR_MSGS[@]} -gt 0 ]; then |
69 | 70 |
local msg="" |
... | ... | |
72 | 73 |
done |
73 | 74 |
report="$(./host-monitor.py error <<< "$msg")" |
74 | 75 |
else |
75 |
report=$(tail -10 "$error_file" | ./host-monitor.py stderr)
|
|
76 |
report=$(./host-monitor.py error <<< "Internal Error")
|
|
76 | 77 |
fi |
77 | 78 |
|
78 | 79 |
eval "echo $(printf "%q" "$report") >&${MONITOR_FD}" |
... | ... | |
354 | 355 |
} |
355 | 356 |
|
356 | 357 |
report_and_cleanup(){ |
357 |
|
|
358 |
local err_file="$1" |
|
359 |
|
|
360 |
report_error "$err_file" |
|
358 |
send_errors |
|
361 | 359 |
cleanup |
362 | 360 |
} |
363 | 361 |
|
Also available in: Unified diff