Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

Added vnc.on command #68

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion lib/rvc/modules/vnc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@
rvc_alias :view, :V

def view vm
vnc_hash = on vm, {}
vnc_client vnc_hash[:ip], vnc_hash[:port], vnc_hash[:password]
end


opts :on do
summary "Enable VNC server"
arg :vm, nil, :lookup => VIM::VirtualMachine
opt :print_password, false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use :default => false instead of positional argument?

end

def on vm, opts
ip = reachable_ip vm.collect('runtime.host')[0]
extraConfig, = vm.collect('config.extraConfig')
already_enabled = extraConfig.find { |x| x.key == 'RemoteDisplay.vnc.enabled' && x.value.downcase == 'true' }
Expand All @@ -49,7 +61,8 @@ def view vm
]
}).wait_for_completion
end
vnc_client ip, port, password
puts "#{ip}:#{port} password: #{password}" if opts[:print_password]
{:ip => ip, :port => port, :password => password}
end


Expand Down