diff --git a/erp5/util/testnode/SlapOSControler.py b/erp5/util/testnode/SlapOSControler.py index dd21301517a295682358dbbcdf7d3c47b754430f..1bcae41e4d1c6b244175edc18187890106b96925 100644 --- a/erp5/util/testnode/SlapOSControler.py +++ b/erp5/util/testnode/SlapOSControler.py @@ -32,12 +32,8 @@ import xml_marshaller class SlapOSControler(object): - def log(self, message): - print message - - def __init__(self, config, process_group_pid_set=None, log=None): - if log is not None: - self.log = log + def __init__(self, config, log, process_group_pid_set=None): + self.log = log self.config = config # By erasing everything, we make sure that we are able to "update" # existing profiles. This is quite dirty way to do updates... diff --git a/erp5/util/testnode/Updater.py b/erp5/util/testnode/Updater.py index 9149f43aef5bbc25ec6bf2b1cdfde67654bc683c..cb06da6fb78f6c04f1301a30f059c75476069e6c 100644 --- a/erp5/util/testnode/Updater.py +++ b/erp5/util/testnode/Updater.py @@ -85,13 +85,8 @@ class Updater(object): realtime_output = True stdin = file(os.devnull) - def log(self, message): - print message - - def __init__(self, repository_path, revision=None, git_binary=None, - log=None): - if log is not None: - self.log = log + def __init__(self, repository_path, log, revision=None, git_binary=None): + self.log = log self.revision = revision self._path_list = [] self.repository_path = repository_path diff --git a/erp5/util/testnode/__init__.py b/erp5/util/testnode/__init__.py index 733c6b292c2ca0981358de3731ba69d9fc9e5993..35744eafe2573ab6dd2b15afb5f014f6999a1712 100644 --- a/erp5/util/testnode/__init__.py +++ b/erp5/util/testnode/__init__.py @@ -48,9 +48,8 @@ def main(*args): parsed_argument = parser.parse_args(list(args)) else: parsed_argument = parser.parse_args() - logger = None + logger = logging.getLogger('erp5testnode') if parsed_argument.console or parsed_argument.logfile: - logger = logging.getLogger('erp5testnode') logger.setLevel(logging.INFO) if parsed_argument.console: logger.addHandler(logging.StreamHandler()) @@ -58,8 +57,9 @@ def main(*args): if parsed_argument.logfile: logger.addHandler(logging.FileHandler(filename=parsed_argument.logfile)) logger.info('Activated logfile %r output' % parsed_argument.logfile) - if logger is not None: - CONFIG['logger'] = logger.info + else: + logger.addHandler(logging.NullHandler()) + CONFIG['logger'] = logger.info config = ConfigParser.SafeConfigParser() # do not change case of option keys config.optionxform = str diff --git a/erp5/util/testnode/testnode.py b/erp5/util/testnode/testnode.py index 386d41dfff6ab5d18c78517e50df41948de03eac..a7b084c1f96e14b144dbfa610acf27f48fca9326 100644 --- a/erp5/util/testnode/testnode.py +++ b/erp5/util/testnode/testnode.py @@ -46,10 +46,6 @@ class SubprocessError(EnvironmentError): from Updater import Updater -def log(message): - # Log to stdout, with a timestamp. - print time.strftime('%Y/%m/%d %H:%M:%S'), message - supervisord_pid_file = None process_group_pid_set = set() def sigterm_handler(signal, frame): @@ -100,6 +96,7 @@ def killPreviousRun(): PROFILE_PATH_KEY = 'profile_path' def run(config): + log = config['logger'] slapgrid = None global supervisord_pid_file supervisord_pid_file = os.path.join(config['instance_root'], 'var', 'run', @@ -225,7 +222,7 @@ branch = %(branch)s # revision log(' %s at %s' % (repository_path, revision)) updater = Updater(repository_path, git_binary=config['git_binary'], - revision=revision) + revision=revision, log=log) updater.checkout() # Now prepare the installation of SlapOS and create instance