61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/vagrant-ec2-metadata.rb', line 61
def execute
options = {}
opts = OptionParser.new do |o|
o.banner = "Usage: vagrant ec2-metadata [options] [name|id]"
o.separator ""
o.separator "Options:"
o.separator ""
o.on("-d", "--daemonize", "Daemonize the servers") do |h|
options[:daemonize] = h
end
end
argv = parse_options(opts)
return if !argv
if options[:daemonize]
puts "Daemonizing servers."
end
argv = @env.active_machines.map(&:first).map(&:to_s) if argv.empty?
require_relative "vagrant-ec2-metadata/server"
threads = []
with_target_vms(argv) do |machine|
port = Config.port(machine)
config = machine.config.ec2_metadata
machine.ui.info("Using profile #{machine.config.ec2_metadata.profile}#{config.role_arn ? " with role #{config.role_arn}":""} (port #{port})")
thread = Thread.new do
server = VagrantEc2Metadata::Server.new(config, port, options, @env)
server.start
end
threads.push(thread)
end
threads.map(&:join)
end
|