Skip to content

Commit 8bf0dc9

Browse files
(FACT-2864) Added debug messages and skipped vlan test on amazon 6
1 parent 551a859 commit 8bf0dc9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

acceptance/tests/facts/networking_facts_with_vlans.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
confine :except, :platform => 'aix'
66
confine :except, :platform => 'osx'
77
confine :except, :platform => 'solaris'
8+
confine :except, :template => 'amazon-6-x86_64' #unable to create VLANs on Amazon 6
89

910
#
1011
# This test is intended to ensure that networking facts resolve vlans

lib/facter/resolvers/networking_linux_resolver.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def retrieve_interfaces
3535
find_dhcp!(interface_name, index + 1, interfaces)
3636
end
3737

38-
log.debug("interfaces = #{interfaces}")
38+
log.debug("Extracted interfaces data\n#{interfaces}")
3939
@fact_list[:interfaces] = interfaces
4040
end
4141

@@ -52,7 +52,7 @@ def split_raw_data_by_interfaces(output)
5252
end
5353

5454
def extract_interface_info_from(raw_data)
55-
# VLAN names are printed as <VLAN name>@<associated_interface>
55+
# VLAN names are printed as <VLAN name>@<associated_interface>, so we do an additional split after `@`
5656
interface_name = raw_data[0].split(':')[1]&.split('@')&.first&.strip
5757

5858
mtu = raw_data[0].match(/mtu (\d*)/)&.captures&.first&.to_i
@@ -103,11 +103,13 @@ def construct_binding(binding_key, interface_name, interfaces, line, regex)
103103
def insert_binding(binding, binding_key, interface_name, interfaces)
104104
interfaces[interface_name][binding_key] = [] if interfaces[interface_name][binding_key].nil?
105105
interfaces[interface_name][binding_key] << binding
106+
log.debug("Adding to interface #{interface_name}, binding:\n#{binding}")
106107
end
107108

108109
def find_dhcp!(interface_name, index, interfaces)
109110
return if !interfaces[interface_name] || interfaces[interface_name][:dhcp]
110111

112+
log.debug("Get DHCP for interface #{interface_name}")
111113
file_content = Facter::Util::FileHelper.safe_read("/run/systemd/netif/leases/#{index}", nil)
112114
dhcp = file_content.match(/SERVER_ADDRESS=(.*)/) if file_content
113115
if dhcp
@@ -153,6 +155,7 @@ def search_internal_leases(interface_name)
153155

154156
def retrieve_default_interface
155157
output = Facter::Core::Execution.execute('ip route get 1', logger: log)
158+
log.debug("'ip route get 1' result is:\n#{output}")
156159

157160
return if output.nil? || output.empty?
158161

0 commit comments

Comments
 (0)