[virt-tools-list] [virt-manager PATCH 1/4] inspection: rename variable for OS type

Pino Toscano ptoscano at redhat.com
Wed Feb 8 15:55:33 UTC 2017


'type' is ambiguous as name, it might conflict with the Python builtin.
Instead, rename it to 'os_type' to get rid of the issue altogether.
---
 virtManager/domain.py     | 2 +-
 virtManager/inspection.py | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/virtManager/domain.py b/virtManager/domain.py
index 9919917..83784f2 100644
--- a/virtManager/domain.py
+++ b/virtManager/domain.py
@@ -149,7 +149,7 @@ def start_job_progress_thread(vm, meter, progtext):
 
 class vmmInspectionData(object):
     def __init__(self):
-        self.type = None
+        self.os_type = None
         self.distro = None
         self.major_version = None
         self.minor_version = None
diff --git a/virtManager/inspection.py b/virtManager/inspection.py
index e8b102d..5100a65 100644
--- a/virtManager/inspection.py
+++ b/virtManager/inspection.py
@@ -179,7 +179,7 @@ class vmmInspection(vmmGObject):
         root = roots[0]
 
         # Inspection results.
-        typ = g.inspect_get_type(root)  # eg. "linux"
+        os_type = g.inspect_get_type(root)  # eg. "linux"
         distro = g.inspect_get_distro(root)  # eg. "fedora"
         major_version = g.inspect_get_major_version(root)  # eg. 14
         minor_version = g.inspect_get_minor_version(root)  # eg. 0
@@ -236,7 +236,7 @@ class vmmInspection(vmmGObject):
 
         # Log what we found.
         logging.debug("%s: detected operating system: %s %s %d.%d (%s)",
-                      prettyvm, typ, distro, major_version, minor_version,
+                      prettyvm, os_type, distro, major_version, minor_version,
                       product_name)
         logging.debug("hostname: %s", hostname)
         if icon:
@@ -245,7 +245,7 @@ class vmmInspection(vmmGObject):
             logging.debug("# apps: %d", len(apps))
 
         data = vmmInspectionData()
-        data.type = str(type)
+        data.os_type = str(os_type)
         data.distro = str(distro)
         data.major_version = int(major_version)
         data.minor_version = int(minor_version)
-- 
2.9.3




More information about the virt-tools-list mailing list