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

Proposed by Ursula Junque on 2016-09-19
Status: Merged
Approved by: Ursula Junque on 2016-09-19
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 2016-09-19 Approve on 2016-09-19
Francis Ginther (community) 2016-09-19 Approve on 2016-09-19
🤖 Landscape Builder test results Approve on 2016-09-19
Review via email:

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.
review: Abstain (executing tests)
review: Approve (test results)
Francis Ginther (fginther) wrote :


review: Approve
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
1=== modified file 'collect-logs'
2--- collect-logs 2016-09-15 17:34:07 +0000
3+++ collect-logs 2016-09-19 18:55:42 +0000
4@@ -264,10 +264,15 @@
5 try:
6 check_output(args, stderr=STDOUT, env=juju.env)
7 except CalledProcessError as e:
8- # Note: tar commands can fail since we are backing up log files
9- # that are actively being written, ignoring such errors is what we
10- # can and should do now. Everything else we might retry as usual.
11- if e.returncode == 1 and "file changed as we read it" in e.output:
12+ # Note: tar command returns 1 for everything it considers a
13+ # warning, 2 for fatal errors. Since we are backing up
14+ # log files that are actively being written, or part of a live
15+ # system, logging and ignoring such warnings (return code 1) is
16+ # what we can do now.
17+ # Everything else we might retry as usual.
18+ if e.returncode == 1:
19+ log.warning(
20+ "tar returned 1, proceeding anyway: {}".format(e.output))
21 break
22 log.warning(
23 "Failed to archive log files on unit {}".format(unit))


People subscribed via source and target branches

to all changes: