Skip to content

Commit

Permalink
Merge pull request #544 from DataDog/albertvaka/check-match-group-exi…
Browse files Browse the repository at this point in the history
…sts-1

Raise if hostname_extraction_regex doesn't capture hostname
  • Loading branch information
albertvaka authored Jul 10, 2019
2 parents 32b6036 + 1771232 commit 20a2741
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/puppet/reports/datadog_reports.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
rescue
raise(Puppet::ParseError, "Invalid hostname_extraction_regex #{HOSTNAME_REGEX}")
end
unless HOSTNAME_EXTRACTION_REGEX.named_captures.has_key? "hostname"
raise(Puppet::ParseError, "hostname_extraction_regex doesn't include a match group named 'hostname': #{HOSTNAME_REGEX}")
end
else
HOSTNAME_EXTRACTION_REGEX = nil
end
Expand Down

0 comments on commit 20a2741

Please sign in to comment.