mitchellh / vagrant-rackspace

Use Vagrant to manage Rackspace Cloud instances.
MIT License
236 stars 155 forks source link

no output until script completely finishes when doing vagrant up provider=rackspace #130

Open buildlackey opened 9 years ago

buildlackey commented 9 years ago

Hi there - i am using vagrant to spin up some servers in a rackspace / open stack cluster. I am using the vagrant rackspace plugin ( https://github.com/mitchellh/vagrant-rackspace ).

My provisioning script executes and works fine -- with one inconvenience, however: I don't see any output from the script until the very end. Somehow all script output seems like it is being buffered, and I do see it.. but not until the script has complete terminated.

I have a workaround which is to 'tee' the output of all the scripts i run to a file which i can look at (during provisioning) if i use the rackspace console to login.. But it would be even better if the output scrolled by immediately as it was produced, rather than being buffered and dumped out at the end.

To reproduce, please try the Vagrantfile with the embedded script below (just change the rackspace credentials). If you run this then the two messages (about sleeping N secdonds) are output at the very end of the provisioning run, rather than one output, followed by another output 40 seconds after the first sleep.

    Vagrant.configure("2") do |config|

             config.vm.box = "dummy" 
             config.ssh.pty = true          # work around issue where sudo requires tty

             config.vm.define :redeleteserver do |redeleteserver|
                     redeleteserver.vm.provision :shell, :inline=> ' ( echo sleeping 40 secs ; sleep 40 ; echo sleep again for 40 secs ; sleep 40 ) | tee /tmp/out'
             end     

             config.ssh.private_key_path = "./id_rsa"

             config.vm.provider :rackspace do |rs| 
                rs.username        = "buildlackey"
                rs.api_key         = "blahblahblah"
                rs.flavor          = /1 GB Performance/
                rs.image           = "bfa5783c-e40e-4668-adc1-feb0ae3d7a46"

                rs.public_key_path = "./id_rsa.pub"
                rs.rackspace_region = :dfw
             end     

    end     
maxlinc commented 9 years ago

I understand your pain! Not getting output in real time can be very annoying.

We don't do anything in this project to control the output - it's all handled by vagrant. So I'm not sure if we'll be able to fix this in this project. The issue may need to be moved to mitchellh/vagrant.

However (to my surprise) I tested it out and it seems like it does not happen when the provider is VirtualBox, so I'm trying to figure out if there's some difference in the tty or ssh on the images that might cause the problem.

You may be able to work around this by disabling the requiretty option in /etc/sudoers on your image, so you don't need to use a pty.

buildlackey commented 9 years ago

thanks, Max. i will try.