Class: Vagrant::Pyinfra::Provisioner

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-pyinfra/provisioner.rb

Instance Method Summary collapse

Instance Method Details

#provisionObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/vagrant-pyinfra/provisioner.rb', line 4

def provision
    ssh_info = @machine.ssh_info
    user = ssh_info[:username]
    host = ssh_info[:host]
    port = ssh_info[:port]

    if ssh_info[:private_key_path].kind_of?(Array)
        private_key = ssh_info[:private_key_path][0]
    else
        private_key = ssh_info[:private_key_path]
    end

    pyinfra_command = (
        "pyinfra " +
        "-i #{host} " +
        "--key #{private_key} " +
        "--port #{port} " +
        "--user #{user} " +
        "#{config.deploy_file}"
    )

    puts "Running: #{pyinfra_command}"
    system pyinfra_command
end