Merge lp:~fgimenez/snappy/fix-zerosize-systemd-failover-test into lp:~snappy-dev/snappy/snappy-moved-to-github

Proposed by Federico Gimenez
Status: Merged
Approved by: Leo Arias
Approved revision: 563
Merged at revision: 561
Proposed branch: lp:~fgimenez/snappy/fix-zerosize-systemd-failover-test
Merge into: lp:~snappy-dev/snappy/snappy-moved-to-github
Diff against target: 30 lines (+11/-0)
1 file modified
_integration-tests/tests/failover/failover_zero_size_file_test.go (+11/-0)
To merge this branch: bzr merge lp:~fgimenez/snappy/fix-zerosize-systemd-failover-test
Reviewer Review Type Date Requested Status
Leo Arias (community) tested Approve
Review via email: mp+263877@code.launchpad.net

Commit message

zero size systemd of new partition made executable to prevent unrecoverable boot failure

Description of the change

Beginning with image #98, the failoverSuite.TestZeroSizeSystemd test was failing on reboot after setting the /lib/systemd/systemd file to empty with this message:

  target filesystem doesn’t have requested /lib/systemd/systemd
  /bin/sh: 0: can’t access tty; job control turned off

The changes in this branch make the empty systemd file executable, which lets the system detect the panic and reboot to the previous partition.

To post a comment you must log in.
562. By Federico Gimenez

Always copy the original FileMode on file renaming

563. By Federico Gimenez

Checked Stat error while getting info of renamed file

Revision history for this message
Leo Arias (elopio) wrote :

Please, file the bug as discussed during the meeting.

review: Approve (tested)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '_integration-tests/tests/failover/failover_zero_size_file_test.go'
2--- _integration-tests/tests/failover/failover_zero_size_file_test.go 2015-06-29 15:52:59 +0000
3+++ _integration-tests/tests/failover/failover_zero_size_file_test.go 2015-07-06 12:50:51 +0000
4@@ -21,6 +21,7 @@
5
6 import (
7 "fmt"
8+ "os"
9 "path/filepath"
10 "strings"
11
12@@ -95,9 +96,19 @@
13 makeWritable(c, basePath)
14 ExecCommand(c, "sudo", "mv", oldFilename, newFilename)
15 ExecCommand(c, "sudo", "touch", oldFilename)
16+
17+ mode := getFileMode(c, newFilename)
18+ ExecCommand(c, "sudo", "chmod", fmt.Sprintf("%o", mode), oldFilename)
19 makeReadonly(c, basePath)
20 }
21
22+func getFileMode(c *C, filePath string) os.FileMode {
23+ info, err := os.Stat(filePath)
24+ c.Check(err, IsNil, Commentf("Error getting Stat of %s", filePath))
25+
26+ return info.Mode()
27+}
28+
29 func getSingleFilename(c *C, pattern string) string {
30 matches, err := filepath.Glob(pattern)
31

Subscribers

People subscribed via source and target branches