Skip user specified endpoints port if those are already in use.

This commit is contained in:
siddheshwar-more 2013-09-24 20:10:32 +05:30 коммит произвёл adamedx
Родитель f4069d9d82
Коммит 748a257e81
1 изменённых файлов: 16 добавлений и 10 удалений

Просмотреть файл

@ -248,18 +248,24 @@ class Azure
if params[:tcp_endpoints] if params[:tcp_endpoints]
params[:tcp_endpoints].split(',').each do |endpoint| params[:tcp_endpoints].split(',').each do |endpoint|
ports = endpoint.split(':') ports = endpoint.split(':')
xml.InputEndpoint { if !(ports.length > 1 && ports[1] == params[:port] || ports.length == 1 && ports[0] == params[:port])
xml.LocalPort ports[0] xml.InputEndpoint {
xml.Name 'tcpport_' + ports[0] + '_' + params[:azure_vm_name] xml.LocalPort ports[0]
if ports.length > 1 xml.Name 'tcpport_' + ports[0] + '_' + params[:azure_vm_name]
xml.Port ports[1] if ports.length > 1
else xml.Port ports[1]
xml.Port ports[0] else
end xml.Port ports[0]
xml.Protocol 'TCP' end
} xml.Protocol 'TCP'
}
else
warn_message = ports.length > 1 ? "#{ports.join(':')} because this ports are" : "#{ports[0]} because this port is"
puts("Skipping tcp-endpoints: #{warn_message} already in use by ssh/winrm endpoint in current VM.")
end
end end
end end
if params[:udp_endpoints] if params[:udp_endpoints]
params[:udp_endpoints].split(',').each do |endpoint| params[:udp_endpoints].split(',').each do |endpoint|
ports = endpoint.split(':') ports = endpoint.split(':')