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
reviewable/pr18780/r1
Toshio Kuratomi 10 years ago
parent 17665d962b
commit a9928492f7

@ -367,12 +367,20 @@ class RedHatWorkstationHostname(Hostname):
class CentOSHostname(Hostname):
platform = 'Linux'
distribution = 'Centos'
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'
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