Skip to content

(#19764) Fix ipaddress issue scanning beyond the first address#431

Merged
adrienthebo merged 1 commit intopuppetlabs:stablefrom
jeffmccune:fix_ipaddress_scanning
Apr 22, 2013
Merged

(#19764) Fix ipaddress issue scanning beyond the first address#431
adrienthebo merged 1 commit intopuppetlabs:stablefrom
jeffmccune:fix_ipaddress_scanning

Conversation

@jeffmccune
Copy link

Without this patch the refactoring of the ipaddress fact in 0e514b8
changed the determination behavior unintentionally. This is a problem
because the behavior change caused the setcode block to scan only one
address in the output of ifconfig. If the first address is a loopback
(127) address, then no additional addresses will be checked.

This patch addresses the problem by restoring the behavior of splitting
the output of ifconfig into lines, then scanning each line. If an
address is matched that begins with 127, then scanning continues.
Otherwise the matched address is determined to be the ipaddress.

The fixture has been extracted from the description of the issue
published in the comment at http://git.io/MbXKEg

Without this patch the refactoring of the ipaddress fact in 0e514b8
changed the determination behavior unintentionally.  This is a problem
because the behavior change caused the setcode block to scan only one
address in the output of ifconfig.  If the first address is a loopback
(127) address, then no additional addresses will be checked.

This patch addresses the problem by restoring the behavior of splitting
the output of `ifconfig` into lines, then scanning each line.  If an
address is matched that begins with 127, then scanning continues.
Otherwise the matched address is determined to be the ipaddress.

The fixture has been extracted from the description of the issue
published in the comment at http://git.io/MbXKEg
@puppetcla
Copy link

CLA Signed by jeffmccune on 2010-08-16 21:00:00 -0700

adrienthebo added a commit that referenced this pull request Apr 22, 2013
(#19764) Fix ipaddress issue scanning beyond the first address
@adrienthebo adrienthebo merged commit 8e31013 into puppetlabs:stable Apr 22, 2013
@adrienthebo
Copy link

summary: Merged into stable in 8e31013 and merged up into master. This should be released in 1.7.1. Thanks!

@floatingatoll
Copy link

Note that this patch was not included in 1.7.1.

florindragos pushed a commit that referenced this pull request Jun 15, 2020
* (FACT-2480) Added the File Util module
* (FACT-2480) Changed combo of File.readable? and File.read/File.readlines with methods from FileHelper module
* (FACT-2480) Added unit tests for when the required files do not exist
* (FACT-2480) Fixed rubocop offenses
* (FACT-2480) Added the Resolvers Utils in the file_loader.rb
* (FACT-2480) Added missing mocks that were breaking the CI
* (FACT-2536) Removed unnecessary loaded files
* (FACT-2480) Fixed some rubocop offenses
Replaced missed file read with open3 with the added safe_read wrapper
Solved file loading issue
* (FACT-2480) Moved file_helper.rb in facter/util folder
* (FACT-2480) Changed FileHelper from a module to a class
* (FACT-2480) Added the FileHelper in file_loader.rb
* (FACT-2542) Changed how FileHelper is called. Instead of using Facter::Util::FileHelper, now it's Util::FileHelper.
Reverted solaris filesystem fact to using open3 instead of reading the file.

Co-authored-by: Andrei Filipovici <andrei.filipovici@andreis-mbp.eth.tsr.corp.puppet.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants