From: James Page Date: Fri, 22 May 2020 06:49:19 +0000 (+0100) Subject: Fix compatibility with Python 3.8 X-Git-Tag: v2.1.0~16^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=56fc7f6160dfe96a564e04f04e7aa2612c4fae5e;p=ceph-deploy.git Fix compatibility with Python 3.8 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 --- diff --git a/ceph_deploy/hosts/remotes.py b/ceph_deploy/hosts/remotes.py index 72dd1f6..47dd0bf 100644 --- a/ceph_deploy/hosts/remotes.py +++ b/ceph_deploy/hosts/remotes.py @@ -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