diff options
author | Simo Sorce <simo@redhat.com> | 2012-09-11 11:15:54 -0400 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2012-09-11 11:15:54 -0400 |
commit | fe666302366c0af4da843b04c2f8b62b29c2129a (patch) | |
tree | 4661c164655795e1549294c5e42b073ecc396746 /make-ad-vm.sh | |
parent | 66830832af6b4d5db3c9adaa0239b72e6e4af9f4 (diff) | |
download | auto-win-vm-ad-fe666302366c0af4da843b04c2f8b62b29c2129a.tar.gz auto-win-vm-ad-fe666302366c0af4da843b04c2f8b62b29c2129a.tar.xz auto-win-vm-ad-fe666302366c0af4da843b04c2f8b62b29c2129a.zip |
Get all IP infor from /etc/hostsmy-master
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 |