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>
pull/53084/head
Marcos Paulo de Souza 6 years ago committed by Sam Doran
parent 04bfec9dfe
commit fa83a711b6

@ -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).

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

Loading…
Cancel
Save