Provide option for non-zero exit code on some non-fatal failures
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 6.5k
- Forks
- 787
- PR merge metrics
- No merged PRs in 30d
Description
This applies at least to st2 action list operation, likely some others as well which operate in similar manner. Currently if executing e.g. st2 action list --pack=x and pack x cannot be found, the exit code is 0. This should likely be kept for backwards compatibility, but it would be helpful for there to be a command line parameter to get non-zero exit code as well.
The use case for this is to get the status of installed pack in order to determine if it should be installed by configuration management. Only if the pack is not installed, the install is scheduled (especially since running install again on package that is already installed still takes ~20s).
Currently this requires a bit of hacky solution of piping result to grep and checking if there is a string "No matching items found" and letting this dictate the grep's exit code.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running st2 action list --pack=x for a missing pack and observe its current output and exit status. Trace the command-line handling for st2 action list and similar non-fatal operations, then define a parameter that preserves the current default while allowing a missing pack to produce a non-zero exit code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100