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

improved detection of distro_name() #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alekibango
Copy link

using executable lsb_release
or files:
/etc/lsb-release
/etc/os-release

to determine short distro id

also adding debian_version to sentinel files - allowing fallback
detection of debian (or derived) system.

using executable lsb_release
      or files:
            /etc/lsb-release
            /etc/os-release

to determine short distro id

also adding  debian_version  to sentinel files - allowing fallback
detection of debian (or derived) system.
@bitprophet
Copy link
Member

Thanks, this looks good, though I haven't had time to test it out yet.

One question: would it make sense to replace the awk usage with Python-level string manipulation? Right now, I'm thinking it'd be safest to default to doing things at the Python level so our dependencies on remote tools is lower.

Granted, awk and sed and friends are nigh universal, but even they can have subtle differences per-platform (eg BSD vs GNU) so if it's easy to do it in Python, I figure why not.

If something is 1 line in awk vs, say,10 lines in Python, that might be a different story :)

@alekibango
Copy link
Author

my awk code should be multiplatform enough :) but ok, i somewhat agree with rewrite

in that case, we should imho write simple functions for some generic operations...
see you later on irc

# and now the fallback method (guess by existing files)
sentinel_files = (
('fedora', ('fedora-release',)),
('centos', ('centos-release',)),
Copy link
Member

Choose a reason for hiding this comment

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

Spun up a Centos 5.7 box today and noticed it only has /etc/redhat-release, no centos-release. (The file does contain "CentOS" though.)

Choose a reason for hiding this comment

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

That's true that I saw this file on CentOS 6.2 and havn't thinked to look at 5.X.

In all cases, RHEL and CentOS are similar and should works identically (and if it's a problem, I guess it must read redhat-release and parse 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

Successfully merging this pull request may close these issues.

3 participants