Skip to content

Commit

Permalink
fix(tests): anonymization now keep integer in place and remove windows
Browse files Browse the repository at this point in the history
CR from each snmpwalk line

Refs:CTOR-666
  • Loading branch information
Evan-Adam committed Dec 23, 2024
1 parent da1e14b commit 479482e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/scripts/slim_walk.pl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# - device names
# - loop
# - floating values (eg sysLoad)
my $ignore_anon_regex = qr{^"?(lo|eth[\d]*|.* memory|.*Swap.*|.*Memory.*|tmpfs|systemStats|systemd-udevd|kdevtmpfs|.*centreontrapd.*|gorgone-.*|[C-Z]:\\.*|(/[\d\w_-]*){1,}|sd[a-z]\d*|loop\d+|\d*\.\d*)"?$};
my $ignore_anon_regex = qr{^"?(lo|eth[\d]*|.* memory|.*Swap.*|.*Memory.*|tmpfs|systemStats|systemd-udevd|kdevtmpfs|.*centreontrapd.*|gorgone-.*|[C-Z]:\\.*|(/[\d\w_-]*){1,}|sd[a-z]\d*|loop\d+|\d*\.?\d*)"?$};

sub oid_matches {
my ($given_oid, $list) = @_;
Expand Down Expand Up @@ -66,7 +66,7 @@ sub extract_oids {
my $fd;
open($fd, '<', $file_to_parse) or die "Could not open $file_to_parse to get OIDs from.";
for my $line (<$fd>) {
# Find all strings looking like OIDs
# Find all strings looking like OIDs
if ($line =~ /.*['"](\.1\.[\.0-9]+)['"].*/) {
print STDERR "Line $line contains an OID: '$1'\n" if (defined($debug));
push @oids, $1;
Expand Down Expand Up @@ -192,6 +192,8 @@ sub usage {
my $is_last_line_to_keep = 0;
for my $line (<$walk_fd>) {
chomp $line;
# remove all CR in the line
$line =~ s/\r//g;
# If the line does not begin with an OID
# If the last processed line has been retained,
# Then append it to the last accepted line
Expand Down

0 comments on commit 479482e

Please sign in to comment.