pyinfra-dev / pyinfra-dev/pyinfra

Ignore errors based on stdout/stderr

Open
#670 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

API spec
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:

  1. The exit_code can be chosen to whatever integer and that would be called success
  2. We can just always say something is successful
  3. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.