mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-25 07:56:38 +00:00
Fix get_distribution() for platforms that may have spaces
The new CentOS 7 beta lists the distribution as "CentOS Linux", which breaks the distribution detection and class loading. This patch fixes that by taking just the first entry in the string when a space is detected.
This commit is contained in:
@@ -129,6 +129,8 @@ def get_distribution():
|
||||
if platform.system() == 'Linux':
|
||||
try:
|
||||
distribution = platform.linux_distribution()[0].capitalize()
|
||||
if " " in distribution:
|
||||
distribution = distribution.split()[0]
|
||||
if not distribution and os.path.isfile('/etc/system-release'):
|
||||
distribution = platform.linux_distribution(supported_dists=['system'])[0].capitalize()
|
||||
if 'Amazon' in distribution:
|
||||
|
||||
Reference in New Issue
Block a user