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

Support XDG specification #436

Merged
merged 1 commit into from
Nov 14, 2020

Conversation

Blokje5
Copy link
Collaborator

@Blokje5 Blokje5 commented Oct 25, 2020

Conftest will now search XDG_DATA_HOME or XDG_DATA_DIRS for the location of the conftest plugins cache. The preference order is as follows:

  1. XDG_DATA_HOME if set and .conftest/plugins exists within the XDG_DATA_HOME dir
  2. XDG_DATA_DIRS if set and .conftest/plugins exists within one of the XDG_DATA_DIRS
  3. ~/.conftest/plugins

First PR for the XDG specification as discussed in #436. This PR makes sure the plugins adhere to the XDG spec. We can follow it up with a PR for the conftest plugins list command.

Conftest will now search XDG_DATA_HOME or XDG_DATA_DIRS for the location of the conftest plugins cache. The preference order is as follows:

1. XDG_DATA_HOME if set and .conftest/plugins exists within the XDG_DATA_HOME dir
2. XDG_DATA_DIRS if set and .conftest/plugins exists within one of the XDG_DATA_DIRS
3. ~/.conftest/plugins

Signed-off-by: Lennard Eijsackers <lennardeijsackers92@gmail.com>
@Blokje5 Blokje5 requested a review from jpreese October 25, 2020 16:29
Copy link
Contributor

@garethr garethr left a comment

Choose a reason for hiding this comment

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

Good idea.

@garethr garethr merged commit 07a60e7 into open-policy-agent:master Nov 14, 2020
@carlpett
Copy link
Contributor

carlpett commented Nov 14, 2020

A bit late to the party - just saw this in the release notes and wanted to check it out.
It seems you assume that the first XDG_DATA_DIRS is the "best". In my case at least, the first value in XDG_DATA_DIRS is set by my window manager to a path in /usr/share, where my user does not have write permissions. I appear to have five paths in that environment variable, and only one which is writeable.
Also, note that XDG_DATA_HOME is probably not set unless the user wants to override the default. Quoth the spec:

If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants