pyinfra-dev / pyinfra-dev/pyinfra
Ignore errors based on stdout/stderr
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 6k
- Forks
- 548
- Avg merge
- 7d 17h
- Merged PRs (30d)
- 13
Description
Currently, we have a few options to decide when an operation is called success:
- The exit_code can be chosen to whatever integer and that would be called success
- We can just always say something is successful
- And other features such as postconditions and timeouts
What I'm interested in is distinguishing whether something is successful based on the stdout/stderr of the operation. For example, if you run the following command twice:
iptables --new foo
you'll get the following error message the second time in stderr:
iptables: Chain already exists.
with an exit code of 1. The problem is that a lot programs don't really have nuance with their exit codes. It's often 0 for success, and then 1 or 2 or whatever for failure.
So what would be useful is to have a decision of pass/failure based on some string matching of the stdout/stderr.
I think ansible might have this feature already, if that helps your decision.
It could be as simple as pass_on_match=<regexp pattern>.
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 reviewing the existing exit_code, always-success, postcondition, and timeout options described in the issue, along with how operation stdout and stderr are exposed. Done means the project has a decided behavior for matching output, including the proposed pass_on_match regular-expression form, and distinguishes matching successes from failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- infrastructure
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100