Commit 79a2e586 by Toshio Kuratomi

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
parent c6b26ff7
...@@ -367,12 +367,20 @@ class RedHatWorkstationHostname(Hostname): ...@@ -367,12 +367,20 @@ class RedHatWorkstationHostname(Hostname):
class CentOSHostname(Hostname): class CentOSHostname(Hostname):
platform = 'Linux' platform = 'Linux'
distribution = 'Centos' 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): class CentOSLinuxHostname(Hostname):
platform = 'Linux' platform = 'Linux'
distribution = 'Centos 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): class ScientificHostname(Hostname):
platform = 'Linux' platform = 'Linux'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment