Class: Vagrant::Provisioners::Shell

Inherits:
Base
  • Object
show all
Defined in:
lib/vagrant/provisioners/shell.rb

Defined Under Namespace

Classes: Config

Instance Attribute Summary

Attributes inherited from Base

#action_env, #config

Instance Method Summary collapse

Methods inherited from Base

#env, #initialize, #prepare, register, registered, #vm

Constructor Details

This class inherits a constructor from Vagrant::Provisioners::Base

Instance Method Details

#provision!Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/vagrant/provisioners/shell.rb', line 33

def provision!
  commands = ["chmod +x #{config.upload_path}", config.upload_path]

  # Upload the script to the VM
  vm.ssh.upload!(config.expanded_path.to_s, config.upload_path)

  # Execute it with sudo
  vm.ssh.execute do |ssh|
    ssh.sudo!(commands) do |ch, type, data|
      if type == :exit_status
        ssh.check_exit_status(data, commands)
      else
        env.ui.info(data)
      end
    end
  end
end