Revision 67fe61c4
b/daemons/ganeti-watcher | ||
---|---|---|
33 | 33 |
import time |
34 | 34 |
import fcntl |
35 | 35 |
import errno |
36 |
import simplejson |
|
37 | 36 |
import logging |
38 | 37 |
from optparse import OptionParser |
39 | 38 |
|
40 | 39 |
from ganeti import utils |
41 | 40 |
from ganeti import constants |
41 |
from ganeti import serializer |
|
42 | 42 |
from ganeti import ssconf |
43 | 43 |
from ganeti import errors |
44 | 44 |
|
... | ... | |
119 | 119 |
self.statefile = f |
120 | 120 |
|
121 | 121 |
try: |
122 |
self.data = simplejson.load(self.statefile)
|
|
122 |
self.data = serializer.Load(self.statefile.read())
|
|
123 | 123 |
except Exception, msg: |
124 | 124 |
# Ignore errors while loading the file and treat it as empty |
125 | 125 |
self.data = {} |
... | ... | |
226 | 226 |
self.statefile.seek(0) |
227 | 227 |
self.statefile.truncate() |
228 | 228 |
|
229 |
simplejson.dump(self.data, self.statefile)
|
|
229 |
self.statefile.write(serializer.Dump(self.data))
|
|
230 | 230 |
|
231 | 231 |
self._Close() |
232 | 232 |
|
Also available in: Unified diff