Use distro.id() instead of distro.name() (#52199)

* Update sys_info unit tests

* Correct distribution values in hostname.py

* Normalize Rhel to Redhat
This commit is contained in:
Sam Doran 2019-03-07 13:25:59 -05:00 committed by GitHub
parent 85ba4d7c73
commit bf28b5ceca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 104 additions and 86 deletions

View file

@ -29,12 +29,12 @@ def get_distribution():
distribution = None
if platform.system() == 'Linux':
distribution = distro.name().capitalize()
distribution = distro.id().capitalize()
# FIXME: Would we need to normalize these if we used: id() instead of name()?
distribution_words = distribution.split()
if 'Amazon' in distribution_words:
if distribution == 'Amzn':
distribution = 'Amazon'
elif distribution == 'Rhel':
distribution = 'Redhat'
elif not distribution:
distribution = 'OtherLinux'