]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
task.ansible: archive the ansible log even if parsing fails 599/head
authorAndrew Schoen <aschoen@redhat.com>
Tue, 18 Aug 2015 15:09:00 +0000 (10:09 -0500)
committerAndrew Schoen <aschoen@redhat.com>
Tue, 18 Aug 2015 15:09:00 +0000 (10:09 -0500)
This fixes a bug where if we fail to parse the ansible log it is never
archived.

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
teuthology/task/ansible.py

index b94efecd75882909ee3448597658ddc476470d2b..7f6efaa9d2ec791ace423e7e913bab3dee377592 100644 (file)
@@ -272,23 +272,26 @@ class Ansible(Task):
                         self.failure_log.name,
                     )
                 )
+                # archive the log anyway so we can see what tripped up
+                # the yaml parsing
+                self._archive_failures()
 
         if failures:
-            if self.ctx.archive:
-                self._archive_failures()
+            self._archive_failures()
             raise AnsibleFailedError(failures)
         raise CommandFailedError(command, status)
 
     def _archive_failures(self):
-        archive_path = "{0}/ansible_failures.yaml".format(self.ctx.archive)
-        log.info("Archiving ansible failure log at: {0}".format(
-            archive_path,
-        ))
-        shutil.move(
-            self.failure_log.name,
-            archive_path
-        )
-        os.chmod(archive_path, 0664)
+        if self.ctx.archive:
+            archive_path = "{0}/ansible_failures.yaml".format(self.ctx.archive)
+            log.info("Archiving ansible failure log at: {0}".format(
+                archive_path,
+            ))
+            shutil.move(
+                self.failure_log.name,
+                archive_path
+            )
+            os.chmod(archive_path, 0664)
 
     def _build_args(self):
         """