Class: VagrantPlugins::ProviderZone::Command::WebVNCConsole
- Inherits:
-
Object
- Object
- VagrantPlugins::ProviderZone::Command::WebVNCConsole
- Defined in:
- lib/vagrant-zones/command/webvnc_console.rb
Overview
This is used to start a WebVNC console to the guest
Instance Method Summary collapse
Instance Method Details
#execute ⇒ Object
9 10 11 12 13 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 |
# File 'lib/vagrant-zones/command/webvnc_console.rb', line 9 def execute = {} opts = OptionParser.new do |o| o. = 'Usage: vagrant zone console webvnc [options]' o.on('--ip <host_ip>', 'Specify host IP to listen on') do |p| [:ip] = p end o.on('--port <port>', 'Specify port to listen on') do |p| [:port] = p end o.on('--detach <yes/no>', 'Run console server in background') do |p| [:detach] = p end o.on('--kill <yes/no>', 'Kill the previous background console session') do |p| [:kill] = p end end argv = (opts) return unless argv unless argv.length <= 4 @env.ui.info(opts.help) return end [:port] = nil unless [:port] =~ /\d/ with_target_vms(argv, provider: :zone) do |machine| driver = machine.provider.driver detach = 'yes' detach = 'no' unless [:detach] == 'yes' kill = 'yes' kill = 'no' unless [:kill] == 'yes' exit = { detach: detach, kill: kill } driver.console(@env.ui, 'webvnc', [:ip], [:port], exit) end end |