]> git.ipfire.org Git - people/shoehn/ipfire.org.git/blame - tools/migrate-fireinfo.py
added background to support section
[people/shoehn/ipfire.org.git] / tools / migrate-fireinfo.py
CommitLineData
66862195
MT
1#!/usr/bin/python
2
3import pymongo
4
5import backend
6
7DATABASE_HOSTS = [
8 "falco.ipfire.org",
9 "wilhelmina.ipfire.org",
10 "miranda.ipfire.org",
11]
12
13connection = pymongo.Connection(DATABASE_HOSTS)
14db = connection["stasy"]
15
16b = backend.Backend("webapp.conf")
17
18c = db.archives.find().sort("updated", pymongo.ASCENDING)
19
20for 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