Skip to content

Commit 20a2741

Browse files
authored
Merge pull request #544 from DataDog/albertvaka/check-match-group-exists-1
Raise if hostname_extraction_regex doesn't capture hostname
2 parents 32b6036 + 1771232 commit 20a2741

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

lib/puppet/reports/datadog_reports.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
rescue
2323
raise(Puppet::ParseError, "Invalid hostname_extraction_regex #{HOSTNAME_REGEX}")
2424
end
25+
unless HOSTNAME_EXTRACTION_REGEX.named_captures.has_key? "hostname"
26+
raise(Puppet::ParseError, "hostname_extraction_regex doesn't include a match group named 'hostname': #{HOSTNAME_REGEX}")
27+
end
2528
else
2629
HOSTNAME_EXTRACTION_REGEX = nil
2730
end

0 commit comments

Comments
 (0)