diff options
Diffstat (limited to 'make-ad-vm.sh')
-rwxr-xr-x | make-ad-vm.sh | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/make-ad-vm.sh b/make-ad-vm.sh index 015b192..921d3b0 100755 --- a/make-ad-vm.sh +++ b/make-ad-vm.sh @@ -51,14 +51,8 @@ fi if [ -z "$VM_FQDN" ] ; then # try to get the ip addr from virsh - VM_IP=`$SUDOCMD virsh net-dumpxml default | grep "'"$VM_NAME"'"|sed "s/^.*ip='\([^']*\)'.*$/\1/"` - if [ -z "$VM_IP" ] ; then - echo Error: your machine $VM_NAME has no IP address in virsh net-dumpxml default - echo Please use virsh net-edit default to specify the IP address for $VM_NAME - echo or set VM_FQDN=full.host.domain in the environment - exit 1 - fi - VM_FQDN=`getent hosts $VM_IP|awk '{print $2}'` + VM_IP=`getent hosts $VM_NAME|awk '{print $1}'` + VM_FQDN=`getent hosts $VM_NAME|awk '{print $2}'` echo using hostname $VM_FQDN for $VM_NAME with IP address $VM_IP fi |