Alon Bar-Lev has posted comments on this change.
Change subject: packaging: setup: Log setup/cleanup/upgrade actions
......................................................................
Patch Set 7: No score
(6 inline comments)
....................................................
File packaging/bin/ovirt-engine-log-setup-event.sh.in
Line 52: esac
Line 53: done
Line 54:
Line 55: get_distro_name() {
Line 56: python -c 'import platform; print
platform.linux_distribution(full_distribution_name=0)[0]'
didn't notice that.
this will fail on python3, you did not use () for print.
also mixing between shell and python is not that wise.
I suggest you simply check if you have rpm or dpkg tools in path.
Line 57: }
Line 58:
Line 59: get_distro_packages() {
Line 60: distro=$(get_distro_name)
Line 56: python -c 'import platform; print
platform.linux_distribution(full_distribution_name=0)[0]'
Line 57: }
Line 58:
Line 59: get_distro_packages() {
Line 60: distro=$(get_distro_name)
quotes, local
Line 61:
Line 62: case "${distro}" in
Line 63: redhat|centos|fedora|SuSE)
Line 64: rpm -qa --last
Line 66: debian|ubuntu)
Line 67: dpkg -l | awk '/^ii/ {print $2, $3}'
Line 68: ;;
Line 69: *)
Line 70: echo "$0: distribution ${distro} not supported"
die?
Line 71: ;;
Line 72: esac
Line 73: }
Line 74:
Line 72: esac
Line 73: }
Line 74:
Line 75: prefix_cmd(){
Line 76: prefix="$1"
missing local
Line 77: shift
Line 78: "$@" 2>&1 | sed "s/^/${prefix}: /"
Line 79: }
Line 80:
Line 75: prefix_cmd(){
Line 76: prefix="$1"
Line 77: shift
Line 78: "$@" 2>&1 | sed "s/^/${prefix}: /"
Line 79: }
more efficient is to execute all command, pipe them into prefix pipe.
prefix_pipe() {
local prefix="$1"
while read l; do
echo "${prefix}: ${l}"
done
}
Line 80:
Line 81: (
Line 82: echo SETUP-EVENT-BEGIN
Line 83: prefix_cmd DATE date +'%Y-%m-%d %H:%M:%S'
Line 88: prefix_cmd VIRSH_VER virsh --version
Line 89: prefix_cmd UNAME_A uname -a
Line 90: prefix_cmd PACKAGE get_distro_packages | sort
Line 91: echo SETUP-EVENT-END
Line 92: ) >> @ENGINE_VAR@/setup-history.txt
(
bla
bla
) | prefix_pipe >> @ENGINE_VAR@/setup-history.txt
--
To view, visit http://gerrit.ovirt.org/15863
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Iae455ff0ef6475f00243906738474134f6f4e6e3
Gerrit-PatchSet: 7
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yedidyah Bar David <[email protected]>
Gerrit-Reviewer: Alex Lourie <[email protected]>
Gerrit-Reviewer: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Kiril Nesenko <[email protected]>
Gerrit-Reviewer: Moran Goldboim <[email protected]>
Gerrit-Reviewer: Sandro Bonazzola <[email protected]>
Gerrit-Reviewer: Yedidyah Bar David <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches