Skip to content

Commit

Permalink
Merge pull request ceph#599 from ceph/wip-archive-ansible-log
Browse files Browse the repository at this point in the history
task.ansible: archive the ansible log even if parsing fails
  • Loading branch information
zmc committed Aug 18, 2015
2 parents 44d58e6 + df6677e commit 5b80153
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions teuthology/task/ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,23 +272,26 @@ def _handle_failure(self, command, status):
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):
"""
Expand Down

0 comments on commit 5b80153

Please sign in to comment.