14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/vagrant-winrm/commands/winrm_config.rb', line 14
def execute
options = {}
opts = OptionParser.new do |o|
o.banner = 'Usage: vagrant winrm-config [options] [name]'
o.separator 'Options:'
o.on('--host NAME', 'Name the host for the config') do |h|
options[:host] = h
end
end
argv = parse_options(opts)
return unless argv
with_target_vms(argv) do |machine|
variables = {
host_key: options[:host] || machine.name || 'vagrant',
winrm_host: VagrantPlugins::CommunicatorWinRM::Helper.winrm_info(machine)[:host],
winrm_port: VagrantPlugins::CommunicatorWinRM::Helper.winrm_info(machine)[:port],
winrm_user: machine.config.winrm.username,
winrm_password: machine.config.winrm.password,
rdp_port: machine.config.rdp.port
}
template = "#{VagrantPlugins::VagrantWinRM.source_root}/templates/winrm_config/config"
safe_puts(Vagrant::Util::TemplateRenderer.render(template, variables))
safe_puts
end
0
end
|