mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-04 15:29:10 -07:00
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:
parent
85ba4d7c73
commit
bf28b5ceca
4 changed files with 104 additions and 86 deletions
|
@ -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'
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue