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:
James Cammarata 2014-06-18 13:10:39 -05:00
parent 3529b1cb33
commit 2493020d9f

View file

@ -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: