From 0fe16f0ab321778236cf8883015b9517a9442577 Mon Sep 17 00:00:00 2001 From: "Ramón M. Gómez" Date: Wed, 11 Dec 2019 14:24:10 +0100 Subject: #940: Replace obsolete function `platform.linux_distribution` with `distro.os_release_attr`. --- admin/Sources/Clients/ogagent/linux/debian/control | 2 +- admin/Sources/Clients/ogagent/linux/ogagent-template.spec | 2 +- admin/Sources/Clients/ogagent/src/opengnsys/linux/operations.py | 7 +++++-- admin/Sources/Clients/ogagent/src/opengnsys/operations.py | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/admin/Sources/Clients/ogagent/linux/debian/control b/admin/Sources/Clients/ogagent/linux/debian/control index 33b22c62..c627c31b 100644 --- a/admin/Sources/Clients/ogagent/linux/debian/control +++ b/admin/Sources/Clients/ogagent/linux/debian/control @@ -10,7 +10,7 @@ Package: ogagent Section: admin Priority: optional Architecture: all -Depends: policykit-1(>=0.100), python-requests (>=0.8.2), python-qt4 (>=4.9), python-six(>=1.1), python-prctl(>=1.1.1), python (>=2.7), libxss1, ${misc:Depends} +Depends: policykit-1(>=0.100), python-requests (>=0.8.2), python-qt4 (>=4.9), python-six(>=1.1), python-prctl(>=1.1.1), python-distro, python (>=2.7), libxss1, ${misc:Depends} Recommends: gnome-shell-extension-top-icons-plus Description: OpenGnsys Agent for Operating Systems This package provides the required components to allow this machine to work on an environment managed by OpenGnsys. diff --git a/admin/Sources/Clients/ogagent/linux/ogagent-template.spec b/admin/Sources/Clients/ogagent/linux/ogagent-template.spec index 31db99b8..b3c7362f 100644 --- a/admin/Sources/Clients/ogagent/linux/ogagent-template.spec +++ b/admin/Sources/Clients/ogagent/linux/ogagent-template.spec @@ -11,7 +11,7 @@ Release: %{release} Summary: OpenGnsys Agent for Operating Systems License: BSD3 Group: Admin -Requires: chkconfig initscripts python-six python-requests PyQt4 libXScrnSaver +Requires: chkconfig initscripts python-six python-requests python-distro PyQt4 libXScrnSaver Vendor: OpenGnsys Project URL: https://opengnsys.es/ Provides: ogagent diff --git a/admin/Sources/Clients/ogagent/src/opengnsys/linux/operations.py b/admin/Sources/Clients/ogagent/src/opengnsys/linux/operations.py index 0c08f95f..f3236e26 100644 --- a/admin/Sources/Clients/ogagent/src/opengnsys/linux/operations.py +++ b/admin/Sources/Clients/ogagent/src/opengnsys/linux/operations.py @@ -42,6 +42,7 @@ import subprocess import struct import array import six +import distro from opengnsys import utils from .renamer import rename @@ -139,8 +140,10 @@ def getDomainName(): def getLinuxVersion(): - lv = platform.linux_distribution() - return lv[0] + ', ' + lv[1] + """ + Returns the version of the Linux distribution + """ + return distro.os_release_attr('pretty_name') def reboot(flags=0): diff --git a/admin/Sources/Clients/ogagent/src/opengnsys/operations.py b/admin/Sources/Clients/ogagent/src/opengnsys/operations.py index 1a274b20..be777dd5 100644 --- a/admin/Sources/Clients/ogagent/src/opengnsys/operations.py +++ b/admin/Sources/Clients/ogagent/src/opengnsys/operations.py @@ -47,4 +47,4 @@ else: else: from .linux.operations import * # @UnusedWildImport os_type = 'Linux' - os_version = getLinuxVersion().replace(',', '') + os_version = getLinuxVersion() -- cgit v1.2.3-18-g5258