Linux &引用;“流浪者上”;成功但是;流浪汉“宋承宪”;以“失败”;VM必须运行才能打开SSH连接;

Linux &引用;“流浪者上”;成功但是;流浪汉“宋承宪”;以“失败”;VM必须运行才能打开SSH连接;,linux,jenkins,vagrant,virtualbox,Linux,Jenkins,Vagrant,Virtualbox,在FedoraLinux3.6.11系统上,我使用Jenkins同时运行两个作业,它们使用相同的脚本在两个不同的VM上测试软件包。其中一个作业经常失败,因为Vagrant无法将ssh(1)连接到它刚刚创建的VM 脚本包含以下内容: set -e $vmName=... ( flock 9; vagrant up $vmName # attempt to prevent concurrent "vagrant up" ) 9>/tmp/`basename $0`-$USER trap "va

在FedoraLinux3.6.11系统上,我使用Jenkins同时运行两个作业,它们使用相同的脚本在两个不同的VM上测试软件包。其中一个作业经常失败,因为Vagrant无法将ssh(1)连接到它刚刚创建的VM

脚本包含以下内容:

set -e
$vmName=...
( flock 9; vagrant up $vmName # attempt to prevent concurrent "vagrant up"
) 9>/tmp/`basename $0`-$USER
trap "vagrant destroy --force $vmName; `trap -p EXIT`" EXIT

# Execute test commands on the virtual machine:
vagrant ssh $vmName -- -T <<EOF
    ...
EOF
set-e
$vmName=。。。
(flock 9;Waggrant up$vmName#尝试防止同时出现“Waggrant up”
)9>/tmp/`basename$0`-$USER
trap“vagrant destroy--force$vmName;`trap-p EXIT`”退出
#在虚拟机上执行测试命令:
流浪ssh$vmName--T
+ flock 9
+ vagrant up centos64_64
Bringing machine 'centos64_64' up with 'virtualbox' provider...
==> centos64_64: Importing base box 'centos-6.4-x86_64-devel'...

 [KProgress: 10%
 ...
 [K==> centos64_64: Matching MAC address for NAT networking...
==> centos64_64: Setting the name of the VM: delivery_centos64_64_1425494409930_40170
==> centos64_64: Fixed port collision for 22 => 2222. Now on port 2200.
==> centos64_64: Clearing any previously set network interfaces...
==> centos64_64: Preparing network interfaces based on configuration...
    centos64_64: Adapter 1: nat
==> centos64_64: Forwarding ports...
    centos64_64: 22 => 2200 (adapter 1)
==> centos64_64: Booting VM...
==> centos64_64: Waiting for machine to boot. This may take a few minutes...
    centos64_64: SSH address: 127.0.0.1:2200
    centos64_64: SSH username: vagrant
    centos64_64: SSH auth method: private key
    centos64_64: Warning: Connection timeout. Retrying...
    centos64_64: Warning: Connection timeout. Retrying...
    centos64_64: Warning: Remote connection disconnect. Retrying...
==> centos64_64: Machine booted and ready!
==> centos64_64: Checking for guest additions in VM...
==> centos64_64: Mounting shared folders...
    centos64_64: /vagrant = <http://spock:8080/jenkins/job/LDM_Acceptance_64 bit_CentOS_6.4/ws/archive/delivery>
centos64_64: /tmp/vagrant-puppet-2/manifests => <http://spock:8080/jenkins/job/LDM_Acceptance_64-bit_CentOS_6.4/ws/archive/delivery/puppet>
==> centos64_64: Running provisioner: puppet...
==> centos64_64: Running Puppet with centos-devel.pp...
==> centos64_64: Notice: Compiled catalog for centos6464.unidata.ucar.edu in environment production in 1.30 seconds
++ trap -p EXIT
+ trap 'vagrant destroy --force centos64_64; ' EXIT
+ vagrant ssh centos64_64 -- -T
VM must be running to open SSH connection. Run `vagrant up`
to start the virtual machine.
+ vagrant destroy --force centos64_64
==> centos64_64: Destroying VM and associated drives...
==> centos64_64: Running cleanup tasks for 'puppet' provisioner...