Vinzenz Feenstra has uploaded a new change for review.

Change subject: Handle exceptions on reading package lists
......................................................................

Handle exceptions on reading package lists

In some cases it might be possible that the package database
is not accessible to non-privileged users.
This patch handles and logs this issue and prevents the exception
from stopping the guest agent thread with an unhandled exception.

Change-Id: Id44210235a3bd8fadf91cb919896c1abe8b4c250
Bug-Url: https://bugzilla.redhat.com/1117632
Signed-off-by: Vinzenz Feenstra <[email protected]>
---
M ovirt-guest-agent/GuestAgentLinux2.py
1 file changed, 7 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-guest-agent 
refs/changes/07/30107/1

diff --git a/ovirt-guest-agent/GuestAgentLinux2.py 
b/ovirt-guest-agent/GuestAgentLinux2.py
index 7734bdc..87ff63a 100644
--- a/ovirt-guest-agent/GuestAgentLinux2.py
+++ b/ovirt-guest-agent/GuestAgentLinux2.py
@@ -73,10 +73,13 @@
         """ Implements the package retrieval for apt and rpm if present and
             returns a joined list of packages installed on the system. """
         apps = set()
-        if self.rpm:
-            apps.update(self.rpm_list_packages(app_list))
-        if self.apt_pkg:
-            apps.update(self.apt_list_packages(app_list))
+        try:
+            if self.rpm:
+                apps.update(self.rpm_list_packages(app_list))
+            if self.apt_pkg:
+                apps.update(self.apt_list_packages(app_list))
+        except Exception:
+            logging.exception("Failed to get package list")
         apps = list(apps)
         logging.debug("PkgMgr: list_pkgs returns [%s]" % (str(apps)))
         return apps


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id44210235a3bd8fadf91cb919896c1abe8b4c250
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-guest-agent
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Vinzenz Feenstra <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to