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.
  • Loading branch information
r-vasquez committed Sep 15, 2023
1 parent 5aa8241 commit 35e6b39
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/go/rpk/pkg/cli/redpanda/tune/tune.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ To learn more about a tuner, run 'rpk redpanda tune help <tuner name>'.
out.MaybeDie(err, "unable to load config: %v", err)
var tunerFactory factory.TunersFactory
if outTuneScriptFile != "" {
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.NewScriptRenderingTunersFactory(fs, y.Rpk.Tuners, outTuneScriptFile, timeout)
} else {
tunerFactory = factory.NewDirectExecutorTunersFactory(fs, y.Rpk.Tuners, timeout)
Expand Down

0 comments on commit 35e6b39

Please sign in to comment.