Skip to content

Commit 614213a

Browse files
committed
resolvers/networking.rb: avoid calling ipconfig unless Windows
The following message was observed when running 'puppet catalog compile' under RUBYOPT="--debug" with Puppet 7 and Facter 4.2.9 on FreeBSD 12.3 ~~~~ Exception `Errno::ENOENT' at /opt/puppet/puppet_wk/puppet_ctl/tools/bundle/ruby/3.0/gems/facter-4.2.9/lib/facter/custom_facts/core/execution/popen3.rb:17 - No such file or directory - ipconfig ~~~~ In order to prevent the call to the Microsoft Windows ipconfig tool, this changeset adds an additional test under the method Facter::Resolvers::Networking.extract_dhcp The patched networking.rb has been tested with Puppet 7 from a local installation under Ruby 3.0 from FreeBSD ports, on FreeBSD 12.3
1 parent 88a4f07 commit 614213a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/facter/resolvers/networking.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ def extract_mac(raw_data, parsed_interface_data)
7171
end
7272

7373
def extract_dhcp(interface_name, raw_data, parsed_interface_data)
74-
return unless raw_data =~ /status:\s+active/
74+
return unless ((raw_data =~ /status:\s+active/) &&
75+
(OsDetector.instance.identifier == :windows))
7576

7677
result = Facter::Core::Execution.execute("ipconfig getoption #{interface_name} " \
7778
'server_identifier', logger: log)

0 commit comments

Comments
 (0)