Alon Bar-Lev has uploaded a new change for review.

Change subject: miniyum: better way to read transaction status
......................................................................

miniyum: better way to read transaction status

Change-Id: I08861c971a24a8d2a5b11903e9233847d0d16f6f
Signed-off-by: Alon Bar-Lev <[email protected]>
---
M src/otopi/miniyum.py
1 file changed, 15 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/otopi refs/changes/44/16744/1

diff --git a/src/otopi/miniyum.py b/src/otopi/miniyum.py
index 38de4d6..78f65f2 100755
--- a/src/otopi/miniyum.py
+++ b/src/otopi/miniyum.py
@@ -36,6 +36,7 @@
 import yum.callbacks
 import yum.Errors
 import yum.callbacks
+import yum.constants
 
 
 class MiniYumSinkBase(object):
@@ -784,17 +785,20 @@
         try:
             with self._disableOutput:
                 ret = []
-                self._yb.tsInfo.makelists()
-                for op, l in (
-                    ('install', self._yb.tsInfo.installed),
-                    ('update', self._yb.tsInfo.updated),
-                    ('install', self._yb.tsInfo.depinstalled),
-                    ('update', self._yb.tsInfo.depupdated),
-                ):
-                    for p in l:
-                        info = self._get_package_info(p)
-                        info['operation'] = op
-                        ret.append(info)
+                state = {
+                    yum.constants.TS_UPDATE: "update",
+                    yum.constants.TS_INSTALL: "install",
+                    yum.constants.TS_TRUEINSTALL: "trueinstall",
+                    yum.constants.TS_ERASE: "erase",
+                    yum.constants.TS_OBSOLETED: "obsoleted",
+                    yum.constants.TS_OBSOLETING: "obsoleting",
+                    yum.constants.TS_AVAILABLE: "available",
+                    yum.constants.TS_UPDATED: "updated",
+                }
+                for txmbr in sorted(self._yb.tsInfo):
+                    info = self._get_package_info(txmbr)
+                    info['operation'] = state[txmbr.output_state]
+                    ret.append(info)
                 return ret
 
         except Exception as e:


-- 
To view, visit http://gerrit.ovirt.org/16744
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I08861c971a24a8d2a5b11903e9233847d0d16f6f
Gerrit-PatchSet: 1
Gerrit-Project: otopi
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to