Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1587 from endocode/dongsu/poweroff-check-error-fx…
Browse files Browse the repository at this point in the history
…tests

functional: poweroff machine using machinectl instead of systemctl
  • Loading branch information
Dongsu Park committed May 24, 2016
2 parents 56b539f + 81c220a commit 441214f
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions functional/platform/nspawn.go
Original file line number Diff line number Diff line change
Expand Up @@ -591,15 +591,9 @@ func (nc *nspawnCluster) ReplaceMember(m Member) (Member, error) {
count := len(nc.members)
label := fmt.Sprintf("%s%s", nc.name, m.ID())

// The `machinectl poweroff` command does not cleanly shut down
// the nspawn container, so we must use systemctl
cmd := fmt.Sprintf("systemctl -M %s poweroff", label)
if _, stderr, _ := run(cmd); !strings.Contains(stderr, "Success") {
if strings.Contains(stderr, "Warning! D-Bus connection terminated.") {
log.Printf("poweroff failed: %s", stderr)
} else {
return nil, fmt.Errorf("poweroff failed: %s", stderr)
}
cmd := fmt.Sprintf("machinectl poweroff %s", label)
if _, _, err := run(cmd); err != nil {
return nil, fmt.Errorf("poweroff failed: %v", err)
}

var mN Member
Expand Down

0 comments on commit 441214f

Please sign in to comment.