Merge lp:~ursinha/landscape-charm/bug-1625307-ignore-tar-warnings into lp:~landscape/landscape-charm/tools

Proposed by Ursula Junque
Status: Merged
Approved by: Ursula Junque
Approved revision: 32
Merged at revision: 32
Proposed branch: lp:~ursinha/landscape-charm/bug-1625307-ignore-tar-warnings
Merge into: lp:~landscape/landscape-charm/tools
Diff against target: 23 lines (+9/-4)
1 file modified
collect-logs (+9/-4)
To merge this branch: bzr merge lp:~ursinha/landscape-charm/bug-1625307-ignore-tar-warnings
Reviewer Review Type Date Requested Status
Andreas Hasenack Approve
Francis Ginther (community) Approve
🤖 Landscape Builder test results Approve
Review via email: mp+306141@code.launchpad.net

Commit message

Fixes bug #1625307: In _create_log_tarball, ignores all exceptions caused by tar returning 1 (warnings).

Description of the change

Fixes bug #1625307: In _create_log_tarball, ignores all exceptions caused by tar returning 1 (warnings).

This needs tests, but I'd need to move things around a bit to be able to do that. I'd rather do that in another branch, to get this fixed asap - we're ending up with empty logs and that makes virtually impossible to debug post-mortem system-tests.

To post a comment you must log in.
Revision history for this message
🤖 Landscape Builder (landscape-builder) :
review: Abstain (executing tests)
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :
review: Approve (test results)
Revision history for this message
Francis Ginther (fginther) wrote :

Approve

review: Approve
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

+1, thanks for the long comments

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'collect-logs'
--- collect-logs 2016-09-15 17:34:07 +0000
+++ collect-logs 2016-09-19 18:55:42 +0000
@@ -264,10 +264,15 @@
264 try:264 try:
265 check_output(args, stderr=STDOUT, env=juju.env)265 check_output(args, stderr=STDOUT, env=juju.env)
266 except CalledProcessError as e:266 except CalledProcessError as e:
267 # Note: tar commands can fail since we are backing up log files267 # Note: tar command returns 1 for everything it considers a
268 # that are actively being written, ignoring such errors is what we268 # warning, 2 for fatal errors. Since we are backing up
269 # can and should do now. Everything else we might retry as usual.269 # log files that are actively being written, or part of a live
270 if e.returncode == 1 and "file changed as we read it" in e.output:270 # system, logging and ignoring such warnings (return code 1) is
271 # what we can do now.
272 # Everything else we might retry as usual.
273 if e.returncode == 1:
274 log.warning(
275 "tar returned 1, proceeding anyway: {}".format(e.output))
271 break276 break
272 log.warning(277 log.warning(
273 "Failed to archive log files on unit {}".format(unit))278 "Failed to archive log files on unit {}".format(unit))

Subscribers

People subscribed via source and target branches

to all changes: