This is the error I am getting:
`prompt': undefined method `chomp' for nil:NilClass (NoMethodError)
It happens sporadically - about 40% of the time.
This is my Vagrantfile (configs variable definition was removed since it contained sensitive info).
Vagrant.configure("2") do |config|
config.vm.box = "aws-box"
config.vm.box_url = "http://ift.tt/1g2W7yw"
# please note - in aws provider the flag is NOT rsync__exclude but instead rsync_exclude (single underscore, not double)
# http://ift.tt/1G2EjaY
config.vm.synced_folder "../synced_folder", "/vagrant", type: "rsync", rsync_exclude: excludes_array
config.vm.provision "shell", inline: environment_provision_script
config.vm.provision "shell" do |s|
s.path = "../provision.sh"
s.privileged = false
end
config.vm.provider :aws do |aws, override|
aws.block_device_mapping = [{ 'DeviceName' => '/dev/sda1', 'Ebs.VolumeSize' => 50 }]
aws.access_key_id = configs['aws']['accessKey']
aws.secret_access_key = configs['aws']['secretAccessKey']
aws.keypair_name = configs['aws']['keypairName']
aws.region = configs['aws']['region']
aws.instance_type = configs['aws']['instanceType']
aws.user_data = "#!/bin/bash\nsed -i -e 's/^Defaults.*requiretty/# Defaults requiretty/g' /etc/sudoers"
aws.ami = configs['aws']['ami']
aws.tags = {
'Name' => configs['aws']['machineName']
}
override.ssh.username = configs['aws']['ssh']['username']
override.ssh.private_key_path = configs['aws']['ssh']['privateKeyPath']
end
end
and this is the stack trace
11:55:30 ==> default: Launching an instance with the following settings...
11:55:30 ==> default: -- Type: m3.large
11:55:30 ==> default: -- AMI: ami-e4ff5c93
11:55:30 ==> default: -- Region: eu-west-1
11:55:30 ==> default: -- Keypair: ui-build-centos
11:55:30 ==> default: -- User Data: yes
11:55:30 ==> default: -- User Data: #!/bin/bash
11:55:30 ==> default: sed -i -e 's/^Defaults.*requiretty/# Defaults requiretty/g' /etc/sudoers
11:55:30 ==> default: -- Block Device Mapping: [{"DeviceName"=>"/dev/sda1", "Ebs.VolumeSize"=>50}]
11:55:30 ==> default: -- Terminate On Shutdown: false
11:55:30 ==> default: -- Monitoring: false
11:55:30 ==> default: -- EBS optimized: false
11:55:30 ==> default: -- Assigning a public IP address in a VPC: false
11:55:35 ==> default: Waiting for instance to become "ready"...
11:56:01 ==> default: Waiting for SSH to become available...
11:56:55 Text will be echoed in the clear. Please install the HighLine or Termios libraries to suppress echoed text.
11:56:55 centos@54.217.146.207's password:==> default: Terminating the instance...
11:56:57 ==> default: Running cleanup tasks for 'shell' provisioner...
11:56:57 ==> default: Running cleanup tasks for 'shell' provisioner...
11:56:57 /var/lib/jenkins/.vagrant.d/gems/gems/net-ssh-2.9.2/lib/net/ssh/prompt.rb:73:in `prompt': undefined method `chomp' for nil:NilClass (NoMethodError)
11:56:57 from /var/lib/jenkins/.vagrant.d/gems/gems/net-ssh-2.9.2/lib/net/ssh/authentication/methods/password.rb:57:in `ask_password'
11:56:57 from /var/lib/jenkins/.vagrant.d/gems/gems/net-ssh-2.9.2/lib/net/ssh/authentication/methods/password.rb:22:in `authenticate'
11:56:57 from /var/lib/jenkins/.vagrant.d/gems/gems/net-ssh-2.9.2/lib/net/ssh/authentication/session.rb:79:in `block in authenticate'
11:56:57 from /var/lib/jenkins/.vagrant.d/gems/gems/net-ssh-2.9.2/lib/net/ssh/authentication/session.rb:66:in `each'
11:56:57 from /var/lib/jenkins/.vagrant.d/gems/gems/net-ssh-2.9.2/lib/net/ssh/authentication/session.rb:66:in `authenticate'
11:56:57 from /var/lib/jenkins/.vagrant.d/gems/gems/net-ssh-2.9.2/lib/net/ssh.rb:211:in `start'
11:56:57 from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/communicators/ssh/communicator.rb:355:in `block (2 levels) in connect'
11:56:57 from /opt/vagrant/embedded/lib/ruby/2.0.0/timeout.rb:66:in `timeout'
11:56:57 from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/communicators/ssh/communicator.rb:334:in `block in connect'
11:56:57 from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/util/retryable.rb:17:in `retryable'
11:56:57 from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/communicators/ssh/communicator.rb:333:in `connect'
11:56:57 from /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/communicators/ssh/communicator.rb:119:in `ready?'
11:56:57 from /var/lib/jenkins/.vagrant.d/gems/gems/vagrant-aws-0.6.0/lib/vagrant-aws/action/run_instance.rb:161:in `block in call'
11:56:57 from /var/lib/jenkins/.vagrant.d/gems/gems/vagrant-aws-0.6.0/lib/vagrant-aws/util/timer.rb:9:in `time'
11:56:57 from /var/lib/jenkins/.vagrant.d/gems/gems/vagrant-aws-0.6.0/lib/vagrant-aws/action/run_instance.rb:155:in `call'
Some background - the vagrant is running as part of an automation that worked flawlessly for a long time (months). Then the following changes occurred:
- We upgraded Vagrant
- We moved to centos
- We added
aws.user_data = "#!/bin/bash\nsed -i -e 's/^Defaults.*requiretty/# Defaults requiretty/g' /etc/sudoers"
to the vagrant file because we got prompts on sudo commands
everything else stayed the same. we don't suspect the last item since it should happen long before ssh step.
we cannot figure out why the stacktrace specifies ask_password as we are using a pem file for authentication.
any suggestion or hint as to how to resolve this would be great!
Aucun commentaire:
Enregistrer un commentaire