Skip to content

Commit

Permalink
Merge pull request #1579 from skateman/vmrc-ipv6
Browse files Browse the repository at this point in the history
Allow VMRC connection to a VMware provider accessed through IPv6
(cherry picked from commit bd4525c)

https://bugzilla.redhat.com/show_bug.cgi?id=1464118
  • Loading branch information
martinpovolny authored and simaishi committed Jun 22, 2017
1 parent 87c36c5 commit fdb6234
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions app/controllers/vm_remote.rb
Expand Up @@ -37,7 +37,7 @@ def launch_vmware_console
:path => "/ticket/#{params[:ticket]}")
}
when "vmrc"
host = @record.ext_management_system.ipaddress || @record.ext_management_system.hostname
host = @record.ext_management_system.hostname || @record.ext_management_system.ipaddress
vmid = @record.ems_ref
{
:host => host,
Expand All @@ -46,12 +46,7 @@ def launch_vmware_console
:api_version => @record.ext_management_system.api_version.to_s,
:os => browser_info(:os),
:name => @record.name,
:vmrc_uri => URI::Generic.build(:scheme => "vmrc",
:userinfo => "clone:#{params[:ticket]}",
:host => host,
:port => 443,
:path => "/",
:query => "moid=#{vmid}")
:vmrc_uri => build_vmrc_uri(host, vmid, params[:ticket])
}
end
render :template => "vm_common/console_#{console_type}",
Expand Down Expand Up @@ -129,4 +124,15 @@ def console_after_task(console_type)
javascript_open_window(url)
end
end

def build_vmrc_uri(host, vmid, ticket)
uri = URI::Generic.build(:scheme => "vmrc",
:userinfo => "clone:#{ticket}",
:host => host,
:port => 443,
:path => "/",
:query => "moid=#{vmid}").to_s
# VMRC doesn't like brackets around IPv6 addresses
uri.sub(/(.*)\[/, '\1').sub(/(.*)\]/, '\1')
end
end

0 comments on commit fdb6234

Please sign in to comment.