equal
deleted
inserted
replaced
4 from twisted.internet import reactor |
4 from twisted.internet import reactor |
5 from twisted.python import log |
5 from twisted.python import log |
6 |
6 |
7 from sqlalchemy import create_engine, pool |
7 from sqlalchemy import create_engine, pool |
8 |
8 |
9 from iro import config |
9 from iro import config, install |
10 from iro.view import xmlrpc |
10 from iro.view import xmlrpc |
11 from iro.model import setEngine, setPool |
11 from iro.model import setEngine, setPool |
12 from iro.controller.pool import startPool, dbPool |
12 from iro.controller.pool import startPool, dbPool |
13 |
13 |
14 class IroService(Service): |
14 class IroService(Service): |
19 |
19 |
20 setEngine(engine) |
20 setEngine(engine) |
21 startPool(reactor) |
21 startPool(reactor) |
22 setPool(dbPool) |
22 setPool(dbPool) |
23 reactor.callWhenRunning(config.readConfig) |
23 reactor.callWhenRunning(config.readConfig) |
|
24 Service.startService(self) |
24 |
25 |
25 |
26 |
26 def get_application(): |
27 def get_application(): |
27 app = Application("Iro") |
28 app = Application("Iro") |
|
29 if not install.checkConfig(): |
|
30 log.err("You can create a sample configuration file by running iro-install") |
|
31 raise Exception("Please update or create your configuration file iro.conf.") |
28 config.init() |
32 config.init() |
|
33 |
|
34 if not install.checkDatabaseConnection(): |
|
35 raise Exception("Can't connect to database") |
|
36 |
|
37 if not install.checkDatabase(): |
|
38 raise Exception("Database not in right format. Please run iro-install --install") |
|
39 |
|
40 routes = [ s for s in config.configParser.sections() if not s in ["main",]] |
|
41 ao = install.getAllRoutes(routes, False) |
|
42 for o in ao["orphand"]: |
|
43 log.msg("Offer(%s) is orphand (no route using this offer)."%o) |
|
44 if ao["added"]: |
|
45 raise Exception("offerlist is not up-to-date.\nPlease run iro-install --update") |
29 |
46 |
30 root = resource.Resource() |
47 root = resource.Resource() |
31 root = xmlrpc.appendResource(root) |
48 root = xmlrpc.appendResource(root) |
32 |
49 |
33 v2 = resource.Resource() |
50 v2 = resource.Resource() |