]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
task.ansible: Don't direct task's logging to file 1713/head
authorZack Cerza <zack@redhat.com>
Tue, 1 Feb 2022 21:21:39 +0000 (14:21 -0700)
committerZack Cerza <zack@redhat.com>
Tue, 15 Feb 2022 19:01:37 +0000 (12:01 -0700)
We only want output generated by ansible itself in ansible.log

Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/task/ansible.py

index 94bc5d4d20dba3a432afa60a1fcd9f4ecdd5bc7b..17105a88490a7c90fb51fc66352eb77844fda1b6 100644 (file)
@@ -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,
         )