[PATCH 1/4] libvirt-guest.init: handle domain name with spaces

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



awk splits the line on consecutive spaces, which breaks getting the name
of a domain whose name contains spaces. Use sed instead to strip the
"Name:" prefix from the line

Signed-off-by: Philipp Hahn <hahn@xxxxxxxxxxxxx>
---
 tools/libvirt-guests.init.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/libvirt-guests.init.sh b/tools/libvirt-guests.init.sh
index 8823d06..ea2189e 100644
--- a/tools/libvirt-guests.init.sh
+++ b/tools/libvirt-guests.init.sh
@@ -105,7 +105,7 @@ guest_name() {
     uuid=$2
 
     name=$(run_virsh_c $uri dominfo $uuid 2>/dev/null | \
-           awk '/^Name:/{print $2}')
+           sed -ne 's/^Name: *//p')
     [ -n "$name" ] || name=$uuid
 
     echo "$name"
-- 
1.7.1


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]