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

Commit

Permalink
Use viper flag, not const, typo in error log
Browse files Browse the repository at this point in the history
  • Loading branch information
marccampbell committed Aug 7, 2018
1 parent 760574e commit 1bbe414
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions pkg/ship/kustomize.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ func (s *Ship) Update(ctx context.Context) error {

if _, noExistingState := existingState.(state.Empty); noExistingState {
debug.Log("event", "state.missing")
return errors.New(`No state file found at ` + constants.StatePath + `, please run "ship init"`)
return errors.New(`No state file found at ` + s.Viper.GetString("state-file") + `, please run "ship init"`)
}

debug.Log("event", "read.chartURL")
helmChartPath := existingState.CurrentChartURL()
if helmChartPath == "" {
return errors.New(`No helm chart URL found at ` + constants.StatePath + `, please run "ship init"`)
return errors.New(`No helm chart URL found at ` + s.Viper.GetString("state-file") + `, please run "ship init"`)
}

debug.Log("event", "fetch latest chart")
Expand All @@ -86,19 +86,19 @@ func (s *Ship) Watch(ctx context.Context) error {

if _, noExistingState := existingState.(state.Empty); noExistingState {
debug.Log("event", "state.missing")
return errors.New(`No state file found at ` + constants.StatePath + `, please run "ship init"`)
return errors.New(`No state file found at ` + s.Viper.GetString("state-file") + `, please run "ship init"`)
}

debug.Log("event", "read.chartURL")
helmChartPath := existingState.CurrentChartURL()
if helmChartPath == "" {
return errors.New(`No current SHA found at ` + constants.StatePath + `, please run "ship init"`)
return errors.New(`No current chart url found at ` + s.Viper.GetString("state-file") + `, please run "ship init"`)
}

debug.Log("event", "read.lastSHA")
lastSHA := existingState.CurrentSHA()
if lastSHA == "" {
return errors.New(`No current SHA found at ` + constants.StatePath + `, please run "ship init"`)
return errors.New(`No current SHA found at ` + s.Viper.GetString("state-file") + `, please run "ship init"`)
}

debug.Log("event", "fetch latest chart")
Expand Down Expand Up @@ -128,7 +128,7 @@ func (s *Ship) Init(ctx context.Context) error {
if s.stateFileExists(ctx) {
debug.Log("event", "state.exists")

useUpdate, err := s.UI.Ask(`State file found at ` + constants.StatePath + `, do you want to start from scratch? (y/N) `)
useUpdate, err := s.UI.Ask(`State file found at ` + s.Viper.GetString("state-file") + `, do you want to start from scratch? (y/N) `)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/specs/chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func (r *Resolver) calculateContentSHA(root string) (string, error) {
})

if err != nil {
return "", err
return "", errors.Wrapf(err, "calculate content sha")
}

return fmt.Sprintf("%x", sha256.Sum256(contents)), nil
Expand Down

0 comments on commit 1bbe414

Please sign in to comment.