Skip to content

Commit

Permalink
rpk: improved err msg in rpk tune --output-script
Browse files Browse the repository at this point in the history
If the user used a directory it would fail without
giving any meaningful error.

Manual Backport of PR redpanda-data#13473
  • Loading branch information
r-vasquez committed Sep 19, 2023
1 parent baf3040 commit 096682a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/go/rpk/pkg/cli/cmd/redpanda/tune/tune.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ To learn more about a tuner, run 'rpk redpanda tune help <tuner name>'.
tunerFactory = factory.NewScriptRenderingTunersFactory(
fs, *cfg, outTuneScriptFile, timeout)
} else {
isDir, err := afero.IsDir(fs, outTuneScriptFile)
out.MaybeDie(err, "unable to check if %q is a dir or a file: %v", outTuneScriptFile, err)
if isDir {
out.Die("please use a filename instead of a directory name in --output-script")
}
tunerFactory = factory.NewDirectExecutorTunersFactory(
fs, *cfg, timeout)
}
Expand Down

0 comments on commit 096682a

Please sign in to comment.