Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the error message more clear in case a path is not accessible #2369

Merged
merged 3 commits into from
Oct 11, 2018

Conversation

masci
Copy link
Contributor

@masci masci commented Oct 10, 2018

What does this PR do?

On Windows, os.path.exists returns False both when a directory doesn't exist and when the user can't access it for lack of permissions, we now mention this in the error message.

Motivation

Since upcoming version of the Agent will run under an unprivileged user, a permission error will be possible in the future, let's be proactive.

Review checklist

  • PR has a meaningful title or PR has the no-changelog label attached
  • Feature or bugfix has tests
  • Git history is clean
  • If PR impacts documentation, docs team has been notified or an issue has been opened on the documentation repo

Additional Notes

Logic doesn't change, it's just the error message

if not ignore_missing:
raise ConfigurationError(msg)

self.log.info(msg)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

info or warning?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, let's raise the log level at this point since permission errors will be eventually possible

@codecov-io
Copy link

Codecov Report

Merging #2369 into master will increase coverage by 9.49%.
The diff coverage is 91.66%.

@@            Coverage Diff             @@
##           master    #2369      +/-   ##
==========================================
+ Coverage   79.56%   89.05%   +9.49%     
==========================================
  Files         204        5     -199     
  Lines       13777      201   -13576     
  Branches     1460       35    -1425     
==========================================
- Hits        10961      179   -10782     
+ Misses       2428       18    -2410     
+ Partials      388        4     -384

Copy link
Member

@olivielpeau olivielpeau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for changing this! Left a small unrelated question.

@@ -8,6 +8,7 @@

from datadog_checks.checks import AgentCheck
from datadog_checks.config import is_affirmative
from datadog_checks.errors import ConfigurationError
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this exception only exists since #2367, shouldn't this be reflected on the version constraint of this integration on the datadog-checks-base wheel? (just asking, not sure what the policy is)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're still transitioning and very few of the checks pin the base check version, directory is one of those not pinning. At this moment there's not a real policy, we help users who need to update to manually setup the right set of packages in the agent on a case by case policy. This will change as soon as we outline the Agent CLI requirements for the single check update.

@masci masci merged commit 206add7 into master Oct 11, 2018
@masci masci deleted the massi/directory branch October 11, 2018 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants