From: Zack Cerza Date: Tue, 1 Feb 2022 21:21:39 +0000 (-0700) Subject: task.ansible: Don't direct task's logging to file X-Git-Tag: 1.2.0~206^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1713%2Fhead;p=teuthology.git task.ansible: Don't direct task's logging to file We only want output generated by ansible itself in ansible.log Signed-off-by: Zack Cerza --- diff --git a/teuthology/task/ansible.py b/teuthology/task/ansible.py index 94bc5d4d2..17105a884 100644 --- a/teuthology/task/ansible.py +++ b/teuthology/task/ansible.py @@ -15,8 +15,7 @@ from teuthology.repo_utils import fetch_repo from teuthology.task import Task -log = logging.Logger(__name__) -log.setLevel(logging.INFO) +log = logging.getLogger(__name__) class LoggerFile(object): """ @@ -112,11 +111,11 @@ class Ansible(Task): def __init__(self, ctx, config): super(Ansible, self).__init__(ctx, config) - self.log = log self.generated_inventory = False self.generated_playbook = False - log.addHandler(logging.FileHandler(os.path.join(ctx.archive, - "ansible.log"))) + self.log = logging.Logger(__name__) + self.log.addHandler(logging.FileHandler( + os.path.join(ctx.archive, "ansible.log"))) def setup(self): super(Ansible, self).setup() @@ -283,7 +282,7 @@ class Ansible(Task): out, status = pexpect.run( command, cwd=self.repo_path, - logfile=_logfile or LoggerFile(log, logging.INFO), + logfile=_logfile or LoggerFile(self.log, logging.INFO), withexitstatus=True, timeout=None, )