Implemented changes to display IP address field for Windows VM on knife azure server list run
This commit is contained in:
Родитель
e6139a2084
Коммит
5efe903f54
|
@ -107,9 +107,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)
|
||||
|
@ -127,13 +127,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')
|
||||
|
|
|
@ -279,11 +279,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)}"
|
||||
|
||||
|
@ -293,7 +293,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)}"
|
||||
|
@ -307,12 +306,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)}"
|
||||
|
|
|
@ -87,8 +87,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
|
||||
|
|
Загрузка…
Ссылка в новой задаче