Waits for a pattern to match output of a command or docker container logs.
Project description
Wait For Output
Waits for a pattern to match output of a command or docker container logs.
Features:
- Waiting for a pattern to appear in docker container logs
- Waiting for a generic command output to appear
- Finding container name by regexp pattern
- Returns result as a exit code and message
- Output of checked command/container log is passed through to the console
Installing
pip install waitforoutput
Usage with docker
--container
takes a regexp expression, or a full container name. Output from container is streamed to the console until timeout is reached, at the end
only result is displayed - the container is not killed.
If multiple containers are found the application will exit with an error.
$ waitforoutput 'Configuration complete; ready for start up' --container 'nginx_*' --timeout 5
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
Match found
Usage with any shell command
Command specified with --command
parameter will be launched, and the waitforoutput
will be streaming output until the --timeout
is reached.
After timeout the process will be killed.
$ waitforoutput 'Linux' --command 'uname -a'
Linux riotkit-dev 5.10.23-1-MANJARO #1 SMP PREEMPT Thu Mar 11 18:47:18 UTC 2021 x86_64 GNU/Linux
Match found
Authors
Created by Riotkit anarchist tech-collective.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for waitforoutput-0.0.1.dev13.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c538f80c1dc0a5268c861cb769571c489a84774f599b4f55df5f553a3f3805b5 |
|
MD5 | 751b821303c45c3f225c6fed94cb5ec6 |
|
BLAKE2b-256 | 89dc072a335804f813fba6cf99035ccb9b3b7b56dbe153761fc74ffab3c400d1 |
Hashes for waitforoutput-0.0.1.dev13-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5acd308043696575ba892e615ca7fbb7ee1a22e4798d77e74499b72d14bf926 |
|
MD5 | 1a5a9627739289a7bb52a6ab527f1334 |
|
BLAKE2b-256 | fecaf70846b22af4987ecdb6f7334b7393986887d8c265e48e3318370f7fe9b1 |