From 4aaa3ab7fc1083788fa4fb1122ad4ae914a26ed1 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Tue, 1 Feb 2022 14:21:39 -0700 Subject: [PATCH] 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 --- teuthology/task/ansible.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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, ) -- 2.47.3