summaryrefslogtreecommitdiff
path: root/cmdline/apt-report-mirror-failure
blob: 7c390642a7ce8a78ed93abf2e1a77754bdd70fe8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/python
#
# This is a stub that is meant to support failure reporting of 
# mirrors to a central database
#
# its currently not used

import sys
import urllib
import apt_pkg

apt_pkg.init()
url = apt_pkg.Config.find("Acquire::Mirror::ReportFailures", "")
                          #"http://people.ubuntu.com:9000/mirror-failure")
                          #"http://localhost:9000/mirror-failure")
if not url:
    sys.exit(0)

print "Reporting mirror failure to '%s'" % url

data = {}
data['mirror'] = sys.argv[1]
data['failurl'] = sys.argv[2]
data['error'] = sys.argv[3]
f = urllib.urlopen(url, urllib.urlencode(data))
f.read()
f.close()