]>
Commit | Line | Data |
---|---|---|
66862195 MT |
1 | #!/usr/bin/python |
2 | ||
3 | import pymongo | |
4 | ||
5 | import backend | |
6 | ||
7 | DATABASE_HOSTS = [ | |
8 | "falco.ipfire.org", | |
9 | "wilhelmina.ipfire.org", | |
10 | "miranda.ipfire.org", | |
11 | ] | |
12 | ||
13 | connection = pymongo.Connection(DATABASE_HOSTS) | |
14 | db = connection["stasy"] | |
15 | ||
16 | b = backend.Backend("webapp.conf") | |
17 | ||
18 | c = db.archives.find().sort("updated", pymongo.ASCENDING) | |
19 | ||
20 | for profile in c: | |
21 | public_id = profile.get("public_id") | |
22 | when = profile.get("updated") | |
23 | ||
24 | print public_id | |
25 | ||
26 | location = None | |
27 | if profile.has_key("geoip") and profile["geoip"]: | |
28 | location = profile["geoip"]["country_code"] | |
29 | ||
30 | print "Importing profile %s..." % public_id | |
31 | try: | |
32 | b.fireinfo.handle_profile(public_id, profile, location=location, when=when) | |
33 | except: | |
34 | print profile | |
35 | raise |