io shaping: detect missing subcommand and surface friendly message#26
Merged
io shaping: detect missing subcommand and surface friendly message#26
Conversation
On EOS instances that ship without the io shaping subcommand (e.g. eosaliceo2-ns-02), `eos io shaping ls` exits 22 and dumps the generic `io stat` / `io enable` usage block on stdout. We were wrapping that as an error and rendering it verbatim in the IO Traffic view, which buried the actual cause under a wall of unrelated help text. Detect the pattern (exit status 22 + usage block that omits any mention of shaping) and return a sentinel ErrIOShapingUnsupported. The view checks for it via errors.Is and renders a short, actionable message instead of the raw output.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On EOS instances that ship without the
io shapingsubcommand (observed oneosaliceo2-ns-02),eos io shaping lsexits 22 and dumps the genericio stat/io enableusage block on stdout. We were wrapping that error and rendering the entire usage text in the IO Traffic view, burying the actual cause.ErrIOShapingUnsupportedsentinel in eos/fetch_ioshaping.go.looksUnsupportedrecognises the pattern: exit status 22 + a usage block that does not mentionshaping. Applied to bothIOShaping()andIOShapingPolicies()call sites.errors.Is(err, eos.ErrIOShapingUnsupported)and shows a two-line message pointing the user ateos io --helpinstead of the raw output.Tests
TestLooksUnsupportedcovers the real eosaliceo2 output, plus negative cases (nil error, exit 1 with the same body, exit 22 with shaping mentioned, exit 22 with unrelated text).Test plan
gofmt -l .clean,go build ./...,go test ./...passmake deploy-botheosaliceo2-ns-02: IO Traffic view shows the friendly message instead of the help dump