Skip to content

Commit c0c66fa

Browse files
committed
Update the report config file check to account for permissions
Right now the report only raises an error if the agent's config file doesn't exist. It should also raise an error if the file isn't readable, otherwise you get a surprising permissions error.
1 parent 71d0987 commit c0c66fa

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/puppet/reports/datadog_reports.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
Puppet::Reports.register_report(:datadog_reports) do
1111

1212
configfile = "/etc/dd-agent/datadog.yaml"
13-
raise(Puppet::ParseError, "Datadog report config file #{configfile} not readable") unless File.exist?(configfile)
13+
raise(Puppet::ParseError, "Datadog report config file #{configfile} not readable") unless File.readable?(configfile)
1414
config = YAML.load_file(configfile)
1515
API_KEY = config[:datadog_api_key]
1616

0 commit comments

Comments
 (0)