2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Merge pull request #486 from ucam-cl-dtg/fix_apt

Use correct apt module functions
This commit is contained in:
Stig Sandbeck Mathisen 2014-05-28 11:21:22 +02:00
commit 624c826a27

View File

@ -96,9 +96,9 @@ def config():
def check_origin(pkg):
#print 'Checking: %s (%s)' % (pkg.name, map(str, pkg.candidateOrigin))
if pkg.candidateOrigin:
if pkg.candidate.origins:
for archive in archives:
for origin in pkg.candidateOrigin:
for origin in pkg.candidate.origins:
#a = origin.archive.rpartition('-')[2]
a = origin.archive.split('-')[origin.archive.count('-')]
if a == archive and origin.origin in origins:
@ -123,7 +123,7 @@ except ImportError:
pkgs = {}
total = 0
for pkg in apt.Cache():
if pkg.isUpgradable:
if pkg.is_upgradable:
a = check_origin(pkg)
pkgs[a] = pkgs.get(a, 0) + 1
total += 1