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

Feature: auto-detect best "privileged" setting #79

Open
jaraco opened this issue Feb 18, 2024 · 3 comments
Open

Feature: auto-detect best "privileged" setting #79

jaraco opened this issue Feb 18, 2024 · 3 comments

Comments

@jaraco
Copy link

jaraco commented Feb 18, 2024

Looking through the issues, it seems to be a common pitfall that most uses can't rely on a privileged call, but the default behavior is privileged=False (for ping and maybe others).

Consider instead allowing a third state, privileged='auto' or privileged=None in which case it would attempt to detect the setting (e.g. privileged = platform.system() != 'Windows' and not os.getuid()).

@ValentinBELYN
Copy link
Owner

I was already thinking about it some time ago. I actually think that would be a good idea. Why not for the next version with something like:

(your second proposal)

privileged=False
privileged=True
privileged=None # auto-detect

Or:

privileged=0 # equivalent to False
privileged=1 # equivalent to True
privileged=2 # auto-detect

@jaraco
Copy link
Author

jaraco commented Apr 21, 2024

I much prefer None to 2. I'm not a big fan of enumerated values; I prefer to use descriptive strings (aka 'auto'), but if you prefer None, I'd take that.

@ValentinBELYN
Copy link
Owner

I don't really like mixing strings with booleans. I'll see what I do when I implement it.

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

No branches or pull requests

2 participants