Make systemd vs rht detection more robust for centos

Centos 6.x and below use an old RHT style of configuring hostname.
CentOS 7.x and better use systemd.  Instead of depending on the
distribution string which seems to have changed over the course of 6.x
we need to explicitly check the version.

Fixes #8997
pull/9028/head
Toshio Kuratomi 11 years ago
parent c6b26ff7c7
commit 79a2e586fe

@ -367,12 +367,20 @@ class RedHatWorkstationHostname(Hostname):
class CentOSHostname(Hostname):
platform = 'Linux'
distribution = 'Centos'
strategy_class = RedHatStrategy
distribution_version = _get_distribution_version()
if distribution_version and LooseVersion(distribution_version) >= LooseVersion("7"):
strategy_class = FedoraStrategy
else:
strategy_class = RedHatStrategy
class CentOSLinuxHostname(Hostname):
platform = 'Linux'
distribution = 'Centos linux'
strategy_class = FedoraStrategy
distribution_version = _get_distribution_version()
if distribution_version and LooseVersion(distribution_version) >= LooseVersion("7"):
strategy_class = FedoraStrategy
else:
strategy_class = RedHatStrategy
class ScientificHostname(Hostname):
platform = 'Linux'

Loading…
Cancel
Save