mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00: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:
@@ -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'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user