Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

Commit

Permalink
sync state update
Browse files Browse the repository at this point in the history
  • Loading branch information
dexhorthy committed May 13, 2019
1 parent 754e2be commit 5343bec
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 18 deletions.
12 changes: 4 additions & 8 deletions pkg/lifecycle/daemon/routes_navcycle_completestep.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/replicatedhq/ship/pkg/api"
"github.com/replicatedhq/ship/pkg/lifecycle/daemon/daemontypes"
"github.com/replicatedhq/ship/pkg/lifecycle/daemon/statusonly"
"github.com/replicatedhq/ship/pkg/state"
"github.com/replicatedhq/ship/pkg/util/warnings"
)

Expand Down Expand Up @@ -67,14 +68,9 @@ func (d *NavcycleRoutes) handleAsync(errChan chan error, debug log.Logger, step
return
}

state, err := d.StateManager.TryLoad()
if err != nil {
level.Error(d.Logger).Log("event", "state.load.fail", "err", err)
return
}

newState := state.Versioned().WithCompletedStep(step)
err = d.StateManager.Save(newState)
_, err := d.StateManager.StateUpdate(func(currentState state.VersionedState) (state.VersionedState, error) {
return currentState.WithCompletedStep(step), nil
})
if err != nil {
level.Error(d.Logger).Log("event", "state.save.fail", "err", err, "step.id", stepID)
return
Expand Down
7 changes: 3 additions & 4 deletions pkg/lifecycle/render/config/daemonresolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ import (

"github.com/mitchellh/cli"
"github.com/replicatedhq/libyaml"
"github.com/spf13/afero"
"github.com/spf13/viper"
"github.com/stretchr/testify/require"

"github.com/replicatedhq/ship/pkg/api"
"github.com/replicatedhq/ship/pkg/lifecycle/daemon"
"github.com/replicatedhq/ship/pkg/lifecycle/daemon/headless"
Expand All @@ -21,6 +17,9 @@ import (
templates "github.com/replicatedhq/ship/pkg/templates"
"github.com/replicatedhq/ship/pkg/testing/logger"
"github.com/replicatedhq/ship/pkg/ui"
"github.com/spf13/afero"
"github.com/spf13/viper"
"github.com/stretchr/testify/require"
)

type daemonResolverTestCase struct {
Expand Down
1 change: 0 additions & 1 deletion pkg/specs/persist.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"strings"

"github.com/pkg/errors"

"github.com/replicatedhq/ship/pkg/state"
)

Expand Down
1 change: 0 additions & 1 deletion pkg/specs/replicatedapp/graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/pkg/errors"
"github.com/replicatedhq/ship/pkg/api"
"github.com/replicatedhq/ship/pkg/state"

"github.com/spf13/viper"
)

Expand Down
4 changes: 1 addition & 3 deletions pkg/specs/stategetter/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ import (
"path/filepath"
"testing"

"github.com/stretchr/testify/require"

"github.com/replicatedhq/ship/pkg/state"
"github.com/replicatedhq/ship/pkg/testing/logger"

"github.com/spf13/afero"
"github.com/stretchr/testify/require"
)

func TestStateGetter_GetFiles(t *testing.T) {
Expand Down
1 change: 0 additions & 1 deletion pkg/state/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/replicatedhq/ship/pkg/constants"
"github.com/replicatedhq/ship/pkg/testing/logger"
"github.com/replicatedhq/ship/pkg/util"

"github.com/spf13/afero"
"github.com/spf13/viper"
"github.com/stretchr/testify/require"
Expand Down

0 comments on commit 5343bec

Please sign in to comment.