]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
Fix compatibility with Python 3.8 496/head
authorJames Page <james.page@ubuntu.com>
Fri, 22 May 2020 06:49:19 +0000 (07:49 +0100)
committerJames Page <james.page@ubuntu.com>
Fri, 22 May 2020 06:49:19 +0000 (07:49 +0100)
The deprecated platform.linux_distribution function was removed
in Python 3.8 - fallback to using parse_os_release if the function
is not found.

Signed-off-by: James Page <james.page@ubuntu.com>
ceph_deploy/hosts/remotes.py

index 72dd1f6d33901b4979f9a100799403a3fb651abb..47dd0bf787d46678fc9224a160e78a7dffca67a0 100644 (file)
@@ -13,8 +13,13 @@ import re
 
 def platform_information(_linux_distribution=None):
     """ detect platform information from remote host """
-    linux_distribution = _linux_distribution or platform.linux_distribution
-    distro, release, codename = linux_distribution()
+    distro = release = codename = None
+    try:
+        linux_distribution = _linux_distribution or platform.linux_distribution
+        distro, release, codename = linux_distribution()
+    except AttributeError:
+        # NOTE: py38 does not have platform.linux_distribution
+        pass
     if not distro:
         distro, release, codename = parse_os_release()
     if not codename and 'debian' in distro.lower():  # this could be an empty string in Debian