Merge pull request #31 from opscode/OC-7767

OC-7767 knife azure server list does not show IP address for windows VMs
This commit is contained in:
Chirag Jog 2013-05-23 23:36:21 -07:00
Родитель 3e48fa48dc 5efe903f54
Коммит 064db97989
6 изменённых файлов: 11 добавлений и 15 удалений

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

@ -121,9 +121,9 @@ class Azure
end
class Role
include AzureUtility
attr_accessor :connection, :name, :status, :size, :ipaddress
attr_accessor :sshport, :sshipaddress, :hostedservicename, :deployname
attr_accessor :winrmport, :winrmipaddress
attr_accessor :connection, :name, :status, :size, :ipaddress, :publicipaddress
attr_accessor :sshport, :hostedservicename, :deployname
attr_accessor :winrmport
attr_accessor :hostname, :tcpports, :udpports
def initialize(connection)
@ -141,13 +141,12 @@ class Azure
@udpports = Array.new
endpoints = roleXML.css('InstanceEndpoint')
@publicipaddress = xml_content(endpoints[0], 'Vip') if !endpoints.empty?
endpoints.each do |endpoint|
if xml_content(endpoint, 'Name').downcase == 'ssh'
@sshport = xml_content(endpoint, 'PublicPort')
@sshipaddress = xml_content(endpoint, 'Vip')
elsif xml_content(endpoint, 'Name').downcase == 'winrm'
@winrmport = xml_content(endpoint, 'PublicPort')
@winrmipaddress = xml_content(endpoint, 'Vip')
else
hash = Hash.new
hash['Name'] = xml_content(endpoint, 'Name')

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

@ -272,11 +272,11 @@ class Chef
end
server = connection.deploys.create(create_server_def)
fqdn = server.publicipaddress
puts("\n")
if is_image_windows?
if locate_config_value(:bootstrap_protocol) == 'ssh'
fqdn = server.sshipaddress
port = server.sshport
print "\n#{ui.color("Waiting for sshd on #{fqdn}:#{port}", :magenta)}"
@ -286,7 +286,6 @@ class Chef
}
elsif locate_config_value(:bootstrap_protocol) == 'winrm'
fqdn = server.winrmipaddress
port = server.winrmport
print "\n#{ui.color("Waiting for winrm on #{fqdn}:#{port}", :magenta)}"
@ -300,12 +299,11 @@ class Chef
sleep 15
bootstrap_for_windows_node(server,fqdn).run
else
unless server && server.sshipaddress && server.sshport
unless server && server.publicipaddress && server.sshport
Chef::Log.fatal("server not created")
exit 1
end
fqdn = server.sshipaddress
port = server.sshport
print "\n#{ui.color("Waiting for sshd on #{fqdn}:#{port}", :magenta)}"

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

@ -92,8 +92,7 @@ class Chef
msg_pair('Deployment', server.deployname)
msg_pair('Role', server.name)
msg_pair('Size', server.size)
msg_pair('SSH Ip Address', server.sshipaddress)
msg_pair('SSH Port', server.sshport)
msg_pair('Public Ip Address', server.publicipaddress)
puts "\n"
confirm("Do you really want to delete this server")

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

@ -60,7 +60,7 @@ class Chef
server_list << server.deployname.to_s
server_list << server.name.to_s
server_list << server.hostname.to_s
server_list << server.sshipaddress.to_s
server_list << server.publicipaddress.to_s
server_list << server.sshport.to_s
server_list << server.winrmport.to_s
end

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

@ -27,7 +27,7 @@ include AzureSpecHelper
role.size.should_not be_nil
role.ipaddress.should_not be_nil
role.sshport.should_not be_nil
role.sshipaddress.should_not be_nil
role.publicipaddress.should_not be_nil
end
end
end
@ -41,7 +41,7 @@ include AzureSpecHelper
puts 'size: ' + role.size
puts 'ip address: ' + role.ipaddress
puts 'ssh port: ' + role.sshport
puts 'ssh ip address: ' + role.sshipaddress
puts 'ssh ip address: ' + role.publicipaddress
role.tcpports.each do |port|
puts ' tcp: ' + port['Name'] + ' ' + port['Vip'] + ' ' +
port['PublicPort'] + ' ' + port['LocalPort']

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

@ -27,6 +27,6 @@ describe "roles" do
role.size.should_not be_nil
role.ipaddress.should_not be_nil
role.sshport.should_not be_nil
role.sshipaddress.should_not be_nil
role.publicipaddress.should_not be_nil
end
end