Ensure the ssh config files are created per distro 61/52861/2
authorFatih Degirmenci <fdegir@gmail.com>
Wed, 28 Feb 2018 18:25:14 +0000 (18:25 +0000)
committerFatih Degirmenci <fdegir@gmail.com>
Wed, 28 Feb 2018 18:38:54 +0000 (18:38 +0000)
If 2 jobs for different distros start on the same host, the
generated xci-vm-config files might be rewritten by both jobs
causing trouble for the other. This change creates ssh config
per distro to prevent potential issues.

Change-Id: If6c0a86fd51bf3ba920e9206849ed1537894c7e1
Signed-off-by: Fatih Degirmenci <fdegir@gmail.com>
xci/scripts/vm/start-new-vm.sh

index 31c7337..78d385b 100755 (executable)
@@ -276,18 +276,21 @@ echo "Adding ${VM_NAME} entry to /etc/hosts"
 sudo sed -i "/.*${VM_NAME}.*/d" /etc/hosts
 sudo bash -c "echo '${_ip} ${VM_NAME}' >> /etc/hosts"
 
+# remove ssh xci-vm-config that uses none-distro specific filename
+/bin/rm -f $HOME/.ssh/xci-vm-config
+
 echo "Dropping a minimal .ssh/config file"
-cat > $HOME/.ssh/xci-vm-config<<EOF
+cat > $HOME/.ssh/${OS}-xci-vm-config<<EOF
 Host *
 StrictHostKeyChecking no
 ServerAliveInterval 60
 ServerAliveCountMax 5
 IdentityFile ${BASE_PATH}/xci/scripts/vm/id_rsa_for_dib
 
-Host *_xci_vm
+Host ${OS}_xci_vm
 User devuser
 
-Host *_xci_vm_opnfv
+Host ${OS}_xci_vm_opnfv
 Hostname 192.168.122.2
 User root
 TCPKeepAlive yes
@@ -296,7 +299,7 @@ ProxyCommand ssh -l devuser -i ${BASE_PATH}/xci/scripts/vm/id_rsa_for_dib ${OS}_
 EOF
 
 # Final ssh command which will also test the configuration file
-declare -r vm_ssh="ssh -F $HOME/.ssh/xci-vm-config"
+declare -r vm_ssh="ssh -F $HOME/.ssh/${OS}-xci-vm-config"
 
 echo "Preparing test environment..."
 # *_xci_vm hostname is invalid. Letst just use distro name