Revision 2635bb04 lib/watcher/__init__.py
b/lib/watcher/__init__.py | ||
---|---|---|
410 | 410 |
for inst in instances]) |
411 | 411 |
|
412 | 412 |
|
413 |
class _StatCb: |
|
414 |
"""Helper to store file handle's C{fstat}. |
|
415 |
|
|
416 |
""" |
|
417 |
def __init__(self): |
|
418 |
"""Initializes this class. |
|
419 |
|
|
420 |
""" |
|
421 |
self.st = None |
|
422 |
|
|
423 |
def __call__(self, fh): |
|
424 |
"""Calls C{fstat} on file handle. |
|
425 |
|
|
426 |
""" |
|
427 |
self.st = os.fstat(fh.fileno()) |
|
428 |
|
|
429 |
|
|
430 | 413 |
def _ReadInstanceStatus(filename): |
431 | 414 |
"""Reads an instance status file. |
432 | 415 |
|
... | ... | |
440 | 423 |
""" |
441 | 424 |
logging.debug("Reading per-group instance status from '%s'", filename) |
442 | 425 |
|
443 |
statcb = _StatCb()
|
|
426 |
statcb = utils.FileStatHelper()
|
|
444 | 427 |
try: |
445 | 428 |
content = utils.ReadFile(filename, preread=statcb) |
446 | 429 |
except EnvironmentError, err: |
Also available in: Unified diff