|
Revision 27, 1.0 KB
(checked in by daedalus, 4 years ago)
|
|
* Added 'authoritarian' mode, which allows you permit/deny each and every command
that will be issued to a remote device. Designed for testing new change scripts.
* Added a 'command_timeout' parameter to Command Provisioners, so you can override
the default command timeout of 300 seconds by setting an attribute in the config
file
* Added proper handling of the 'onfail: continue' idea. You can now specify that
if a change fails, and it is a pre-requisite for some other change, processing
will continue despite the failure.
* Added the onfail: retry feature. If a change fails, you can specify that it should
be retried. You can also set a max number of retries. The default is 3.
|
| Line | |
|---|
| 1 | # $Id$ |
|---|
| 2 | # |
|---|
| 3 | ##COPYRIGHT## |
|---|
| 4 | |
|---|
| 5 | __version__ = '$Revision: 1.28 $' |
|---|
| 6 | |
|---|
| 7 | import os |
|---|
| 8 | import os.path |
|---|
| 9 | import threading |
|---|
| 10 | import logging |
|---|
| 11 | import logging.handlers |
|---|
| 12 | import sys |
|---|
| 13 | |
|---|
| 14 | #FORMAT = "%(asctime)s %(levelname)7s [%(thread)x] (%(module)s) %(message)s" |
|---|
| 15 | #FORMAT = "%(asctime)s %(levelno)2s (%(module)s) %(message)s" |
|---|
| 16 | FORMAT = "%(asctime)s %(levelname)7s: %(message)s" |
|---|
| 17 | formatter = logging.Formatter(FORMAT, '%Y-%m-%d %H:%M:%S') |
|---|
| 18 | |
|---|
| 19 | stdoutHandler = logging.StreamHandler(sys.stdout) |
|---|
| 20 | stdoutHandler.setFormatter(formatter) |
|---|
| 21 | |
|---|
| 22 | class LocalLogger(logging.Logger): |
|---|
| 23 | |
|---|
| 24 | def __init__(self, name): |
|---|
| 25 | level = logging.INFO |
|---|
| 26 | logging.Logger.__init__(self, name, level) |
|---|
| 27 | self.addHandler(stdoutHandler) |
|---|
| 28 | return |
|---|
| 29 | pass |
|---|
| 30 | |
|---|
| 31 | def add_file_handler(filename): |
|---|
| 32 | handler = logging.handlers.RotatingFileHandler(filename=filename, maxBytes=10e6, backupCount=10) |
|---|
| 33 | handler.setFormatter(formatter) |
|---|
| 34 | log = logging.getLogger('modipy') |
|---|
| 35 | log.addHandler(handler) |
|---|
| 36 | |
|---|
| 37 | logging.setLoggerClass(LocalLogger) |
|---|
| 38 | |
|---|