4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/vagrant-fabric/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
if config.remote == false
system "#{config.fabric_path} -f #{config.fabfile_path} " +
"-i #{private_key} --user=#{user} --hosts=#{host} " +
"--port=#{port} #{config.tasks.join(' ')}"
else
if config.install
@machine.communicate.sudo("pip install fabric")
@machine.env.ui.info "Finished to install fabric library your VM."
end
@machine.communicate.execute("cd #{config.remote_current_dir} && " +
"#{config.fabric_path} -f #{config.fabfile_path} " +
"--user=#{user} --hosts=127.0.0.1 --password=#{config.remote_password} " +
"#{config.tasks.join(' ')}")
@machine.env.ui.info "Finished to execute tasks of fabric."
end
end
|