Skip to content

Commit

Permalink
Don't fail in stage subcmds when --workspace is undefined but --sta…
Browse files Browse the repository at this point in the history
…ge-store is set (#180)
  • Loading branch information
ethanjli authored Apr 13, 2024
1 parent cb09f4a commit 9db8bd8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## 0.7.0-alpha.3 - 2024-04-13

### Fixed

- (cli) Subcommands under `stage` no longer require the workspace to be set via `--workspace` or `FORKLIFT_WORKSPACE` (which defaults to `$HOME`, which may be unset in systemd system services) if the path to the stage store is explicitly set via `--stage-store` or `FORKLIFT_STAGE_STORE`.

## 0.7.0-alpha.2 - 2024-04-13

### Added
Expand Down
19 changes: 13 additions & 6 deletions cmd/forklift/stage/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,20 @@ func loadNextBundle(
return bundle, store, nil
}

func getStageStore(wpath, sspath string, versions Versions) (*forklift.FSStageStore, error) {
workspace, err := forklift.LoadWorkspace(wpath)
if err != nil {
return nil, err
func getStageStore(
wpath, sspath string, versions Versions,
) (store *forklift.FSStageStore, err error) {
var workspace *forklift.FSWorkspace
if sspath == "" {
workspace, err = forklift.LoadWorkspace(wpath)
if err != nil {
return nil, errors.Wrap(
err, "couldn't load workspace to load the stage store, since no explicit path was "+
"provided for the stage store",
)
}
}
store, err := fcli.GetStageStore(workspace, sspath, versions.NewStageStore)
if err != nil {
if store, err = fcli.GetStageStore(workspace, sspath, versions.NewStageStore); err != nil {
return nil, err
}
return store, nil
Expand Down

0 comments on commit 9db8bd8

Please sign in to comment.