Better information from yumcmd.update

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Prior to this patch, the yumcmd.update() method returned true even if the package *was not* updated. This bit me as I was assuming that it would return false or an error if the update did not occur.

Now it returns a list of the packages that were actually updated.
-------------
Regards,
Alex

--
Software Engineer
Red Hat
919.754.4445
>From 8f258ef2172ea299beb8fe0e2639fa84f9fff960 Mon Sep 17 00:00:00 2001
From: Alex Wood <awood@xxxxxxxxxx>
Date: Thu, 24 Jul 2008 17:41:53 -0400
Subject: [PATCH] Previously the update method returned true even if yum didn't actually update.

Now it returns the list of packages updated.
---
 func/minion/modules/yumcmd.py |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/func/minion/modules/yumcmd.py b/func/minion/modules/yumcmd.py
index 3f30ec9..0048fc6 100644
--- a/func/minion/modules/yumcmd.py
+++ b/func/minion/modules/yumcmd.py
@@ -26,23 +26,22 @@ class Yum(func_module.FuncModule):
     description = "Package updates through yum."
 
     def update(self, pkg=None):
-        # XXX support updating specific rpms
         ayum = yum.YumBase()
         ayum.doGenericSetup()
         ayum.doRepoSetup()
         try:
             ayum.doLock()
             if pkg != None:
-                ayum.update(name=pkg)
+                tx_result = ayum.update(name=pkg)
             else:
-                ayum.update()
+                tx_result = ayum.update()
             ayum.buildTransaction()
             ayum.processTransaction(
                     callback=DummyCallback())
         finally:
             ayum.closeRpmDB()
             ayum.doUnlock()
-        return True
+        return map(str, tx_result)
 
     def check_update(self, filter=[], repo=None):
         """Returns a list of packages due to be updated
-- 
1.5.4.1

_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list

[Index of Archives]     [Fedora Users]     [Linux Networking]     [Fedora Legacy List]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux