diff --git a/base/password.py b/base/password.py index 45c6641..62d93ca 100644 --- a/base/password.py +++ b/base/password.py @@ -78,10 +78,15 @@ def get_distro_name(): os_name = None try: import platform - os_name = platform.dist()[0] except ImportError: os_name = None + try: + os_name = platform.dist()[0] + except AttributeError: + import distro + os_name = distro.linux_distribution()[0] + if not os_name: name = os.popen('lsb_release -i | cut -f 2') os_name = name.read().strip() @@ -140,7 +145,11 @@ class Password(object): self.__authType = AUTH_TYPES[distro_name] if distro_name == 'fedora': import platform - ver = int(platform.dist()[1]) + try: + ver = int(platform.dist()[1]) + except AttributeError: + import distro + ver = int(distro.linux_distribution()[1]) if ver >= 28: self.__authType = AUTH_TYPES['fedora28'] except KeyError: diff --git a/installer/core_install.py b/installer/core_install.py index 9a3b5ac..af1348d 100644 --- a/installer/core_install.py +++ b/installer/core_install.py @@ -640,8 +640,15 @@ class CoreInstall(object): # Getting distro information using platform module try: import platform - name = platform.dist()[0].lower() - ver = platform.dist()[1] + try: + name = platform.dist()[0].lower() + ver = platform.dist()[1] + except AttributeError: + import distro + + name = distro.linux_distribution()[0].lower() + ver = distro.linux_distribution()[1] + if not name: found = False log.debug("Not able to detect distro")