From f6ebd7f15a02f3c1829d4797ce2d60686b7bff98 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Sun, 23 Feb 2014 10:49:17 -0500 Subject: [PATCH] add indent function in order to make the output more readable, indent the command output separate from the echo before the command. Change-Id: I2783d756f916083f172032b05a2b03d286835f40 --- devstack-vm-gate-wrap.sh | 10 +++++----- functions.sh | 6 ++++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/devstack-vm-gate-wrap.sh b/devstack-vm-gate-wrap.sh index 4e92c1fe..c0c57019 100755 --- a/devstack-vm-gate-wrap.sh +++ b/devstack-vm-gate-wrap.sh @@ -250,14 +250,14 @@ fi echo "Triggered by: https://review.openstack.org/$ZUUL_CHANGE patchset $ZUUL_PATCHSET" echo "Pipeline: $ZUUL_PIPELINE" echo "IP configuration of this host:" -ip addr show +indent ip addr show echo "IP routing tables of this host:" -ip route show -ip -6 route show +indent ip route show +indent ip -6 route show echo "ARP table of this host:" -ip neighbor show +indent ip neighbor show echo "Available disk space on this host:" -df -h +indent df -h tsfilter setup_host &> $WORKSPACE/logs/devstack-gate-setup-host.txt diff --git a/functions.sh b/functions.sh index 61e2bb15..614c91c9 100644 --- a/functions.sh +++ b/functions.sh @@ -33,6 +33,12 @@ function tsfilter { }' } +# indent the output of a command 4 spaces, useful for distinguishing +# the output of a command from the command itself +function indent { + $@ | (while read; do echo " $REPLY"; done) +} + # Attempt to fetch a git ref for a project, if that ref is not empty function git_fetch_at_ref { local project=$1