Revision 9e98ba3c logic/reconciliation.py
b/logic/reconciliation.py | ||
---|---|---|
56 | 56 |
|
57 | 57 |
""" |
58 | 58 |
|
59 |
import logging |
|
59 | 60 |
import sys |
60 | 61 |
|
61 |
from synnefo.logic import log |
|
62 |
_logger = log.get_logger("reconciliation") |
|
63 |
|
|
64 | 62 |
from django.core.management import setup_environ |
65 | 63 |
try: |
66 | 64 |
from synnefo import settings |
... | ... | |
70 | 68 |
setup_environ(settings) |
71 | 69 |
|
72 | 70 |
from synnefo.db.models import VirtualMachine |
71 |
from synnefo.util.dictconfig import dictConfig |
|
73 | 72 |
from synnefo.util.rapi import GanetiRapiClient |
74 | 73 |
|
75 | 74 |
|
75 |
log = logging.getLogger() |
|
76 |
|
|
77 |
|
|
76 | 78 |
def stale_servers_in_db(D, G): |
77 | 79 |
idD = set(D.keys()) |
78 | 80 |
idG = set(G.keys()) |
... | ... | |
116 | 118 |
try: |
117 | 119 |
id = int(i['name'].split(prefix)[1]) |
118 | 120 |
except Exception: |
119 |
_logger.error("Ignoring instance with malformed name %s",
|
|
121 |
log.error("Ignoring instance with malformed name %s",
|
|
120 | 122 |
i['name']) |
121 | 123 |
continue |
122 | 124 |
|
123 | 125 |
if id in snf_instances: |
124 |
_logger.error("Ignoring instance with duplicate Synnefo id %s",
|
|
126 |
log.error("Ignoring instance with duplicate Synnefo id %s",
|
|
125 | 127 |
i['name']) |
126 | 128 |
continue |
127 | 129 |
|
... | ... | |
135 | 137 |
|
136 | 138 |
|
137 | 139 |
if __name__ == "__main__": |
138 |
log.console_output(_logger)
|
|
140 |
dictConfig(settings.RECONCILIATION_LOGGING)
|
|
139 | 141 |
sys.exit(main()) |
Also available in: Unified diff