Skip to content

Commit

Permalink
snap: rename refresh-mode: survive to keep
Browse files Browse the repository at this point in the history
  • Loading branch information
mvo5 committed Feb 8, 2018
1 parent 7b774c6 commit dbc944a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion snap/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ func ValidateApp(app *AppInfo) error {

// validate refresh-mode
switch app.RefreshMode {
case "", "restart", "survive":
case "", "keep", "restart":
// valid
default:
return fmt.Errorf(`"refresh-mode" field contains invalid value %q`, app.RefreshMode)
Expand Down
4 changes: 2 additions & 2 deletions snap/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ func (s *ValidateSuite) TestAppRefreshMode(c *C) {
}{
// good
{"", true},
{"keep", true},
{"restart", true},
{"survive", true},
// bad
{"invalid-thing", false},
} {
Expand All @@ -378,7 +378,7 @@ func (s *ValidateSuite) TestAppRefreshMode(c *C) {
}

// non-services cannot have a refresh-mode
err := ValidateApp(&AppInfo{Name: "foo", Daemon: "", RefreshMode: "survive"})
err := ValidateApp(&AppInfo{Name: "foo", Daemon: "", RefreshMode: "keep"})
c.Check(err, ErrorMatches, `"refresh-mode" cannot be used for "foo", only for services`)
}

Expand Down
2 changes: 1 addition & 1 deletion tests/lib/snaps/test-snapd-service/meta/snap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ apps:
command: bin/start-survive
stop-command: bin/stop-survive
daemon: simple
refresh-mode: survive
refresh-mode: keep
4 changes: 2 additions & 2 deletions wrappers/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ func StopServices(apps []*snap.AppInfo, reason snap.ServiceStopReason, inter int
if !app.IsService() || !osutil.FileExists(app.ServiceFile()) {
continue
}
// Skip stop on refresh when refresh mode is "survive"
if app.RefreshMode == "survive" && reason == snap.StopReasonRefresh {
// Skip stop on refresh when refresh mode is "keep"
if app.RefreshMode == "keep" && reason == snap.StopReasonRefresh {
continue
}
if err := stopService(sysd, app, inter); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion wrappers/services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ version: 1.0
apps:
survivor:
command: bin/survivor
refresh-mode: survive
refresh-mode: keep
daemon: simple
`
info := snaptest.MockSnap(c, surviveYaml, &snap.SideInfo{Revision: snap.R(1)})
Expand Down

0 comments on commit dbc944a

Please sign in to comment.