Fix hostname when get_distribution_version() returns a string.

The distro version is a string ('jessie/sid') on Debian unstable and testing.
Because load_platform_subclass() evaluations every subclass as it loops,
comparing numbers when get_distribution_version() does not return a number will
break.

This patch fixes that by returning a number (`0`) when we have an invalid
version, instead of returning `None` or a string.
pull/8087/head
Bjorn Neergaard 11 years ago
parent c96b2ae391
commit 08f97c0b9d

@ -188,8 +188,11 @@ def get_distribution_version():
except: except:
# FIXME: MethodMissing, I assume? # FIXME: MethodMissing, I assume?
distribution_version = platform.dist()[1] distribution_version = platform.dist()[1]
if type(distribution_version) == str:
distribution_version = 0
else: else:
distribution_version = None distribution_version = 0
return distribution_version return distribution_version
def load_platform_subclass(cls, *args, **kwargs): def load_platform_subclass(cls, *args, **kwargs):

Loading…
Cancel
Save