hostname.py: Fix openSUSE distribution name (#47020)

All openSUSE distributions changed to the way they are returned from distro.id().

This patches fix the openSUSE Leap and SLES distro names, and adds one entry for Tumbleweed.

These descriptions are capitilized, as expected by Ansible's hostname module.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
This commit is contained in:
Marcos Paulo de Souza 2019-02-27 18:18:32 -03:00 committed by Sam Doran
parent 04bfec9dfe
commit fa83a711b6
2 changed files with 11 additions and 2 deletions

View file

@ -0,0 +1,3 @@
bugfixes:
- Add code to detect correctly a host running openSUSE Tumbleweed
- Fix detection string for SUSE distribution variants like Leap and SLES (SUSE Enterprise Linux Server).

View file

@ -565,7 +565,7 @@ class FedoraHostname(Hostname):
class SLESHostname(Hostname):
platform = 'Linux'
distribution = 'Suse linux enterprise server '
distribution = 'Sles'
try:
distribution_version = get_distribution_version()
# cast to float may raise ValueError on non SLES, we use float for a little more safety over int
@ -579,7 +579,13 @@ class SLESHostname(Hostname):
class OpenSUSEHostname(Hostname):
platform = 'Linux'
distribution = 'Opensuse '
distribution = 'Opensuse leap'
strategy_class = SystemdStrategy
class TumbleweedHostname(Hostname):
platform = 'Linux'
distribution = 'Opensuse tumbleweed'
strategy_class = SystemdStrategy