Improved output.

This commit is contained in:
Philippe PITTOLI 2019-10-07 01:49:39 +02:00
parent e45da83235
commit ec6b9f4c29

View File

@ -330,13 +330,19 @@ class WirelessAPSetup
str << "\t\tmtu #{mtu}\n" unless mtu.nil? str << "\t\tmtu #{mtu}\n" unless mtu.nil?
# ipv4 # ipv4
str << "\t\tinet #{@main_ip_v4}\n" unless main_ip_v4.is_a?(NotSetup)
@aliasses_v4.each do |a| str << "\t\tinet #{main_ip_v4}\n"
end
aliasses_v4.each do |a|
str << "\t\talias #{a}\n" str << "\t\talias #{a}\n"
end end
# ipv6 # ipv6
str << "\t\tinet6 #{@main_ip_v6}\n" unless main_ip_v6.is_a?(NotSetup)
str << "\t\tinet6 #{main_ip_v6}\n"
end
unless @aliasses_v6.empty? unless @aliasses_v6.empty?
@aliasses_v6.each do |a| @aliasses_v6.each do |a|
str << "\t\talias6 #{a}\n" str << "\t\talias6 #{a}\n"
@ -417,7 +423,10 @@ class InterfaceConfiguration
end end
# ipv4 # ipv4
unless main_ip_v4.is_a?(NotSetup)
str << "\tinet #{main_ip_v4}\n" str << "\tinet #{main_ip_v4}\n"
end
unless aliasses_v4.empty? unless aliasses_v4.empty?
aliasses_v4.each do |a| aliasses_v4.each do |a|
str << "\talias #{a}\n" str << "\talias #{a}\n"
@ -425,25 +434,23 @@ class InterfaceConfiguration
end end
# ipv6 # ipv6
unless main_ip_v6.is_a?(NotSetup)
str << "\tinet6 #{main_ip_v6}\n" str << "\tinet6 #{main_ip_v6}\n"
end
unless aliasses_v6.empty? unless aliasses_v6.empty?
aliasses_v6.each do |a| aliasses_v6.each do |a|
str << "\talias6 #{a}\n" str << "\talias6 #{a}\n"
end end
end end
if dns.empty? unless dns.empty?
str << "\tno dns configured\n"
else
dns.each do |ip| dns.each do |ip|
str << "\tdns: #{ip}\n" str << "\tdns: #{ip}\n"
end end
end end
if wireless_networks.empty? unless wireless_networks.empty?
str << "\tno wireless connection configured\n" if wireless
else
# to improve readability # to improve readability
str << "\n" str << "\n"
wireless_networks.each do |k,v| wireless_networks.each do |k,v|