Gael Chamoulaud 64b94692a5 Fix bashate errors
- Excluding awk and python scripts.
- The Bashate E012 rule ('heredoc did not end before EOF') could be simply
  ignored until the bashate bug will be fixed.

Change-Id: Id72665aba83df753364940c82db08edcb11e1217
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
2015-03-13 19:11:05 +01:00

21 lines
353 B
Bash
Executable File

#!/bin/sh
set -eu
PATH=$PATH:/usr/sbin:/sbin
if [ "$#" -lt 1 ]; then
echo "Usage: $(basename $0) <vm-name>"
exit 1
fi
VMNAME=$1
vms=$(sudo virsh list --all | grep $VMNAME | awk '{ print $2 }')
macs=""
for vm in $vms ; do
macs="$(sudo virsh dumpxml $vm | grep "mac address" | head -1 | awk -F "'" '{ print $2 }') $macs"
done
echo $macs