Skip to content
Snippets Groups Projects
Verified Commit 53e638a4 authored by Jan Pavlíček's avatar Jan Pavlíček
Browse files

feat: run_probes.py now allows to select probes to run with optional argument

parent 48158f6f
No related branches found
No related tags found
1 merge request!78feat: run_probes.py now allows to select probes to run with optional argument
Pipeline #615595 passed
#!/usr/bin/python3
import argparse
import re
import subprocess
import sys
......@@ -73,9 +74,27 @@ def run_probe(probe_name, command, timeout):
return result.returncode
def parse_arguments():
parser = argparse.ArgumentParser()
parser.add_argument(
"-p",
"--probes",
nargs="+",
default=[],
help="Optional list of probes to run from the config."
"If not specified, all probes will be run.",
)
args = parser.parse_args()
return args
def main():
args = parse_arguments()
probes_to_run = args.probes
config_filepath = "/etc/run_probes_cfg.yaml"
config = yaml.safe_load(open_file(config_filepath))
if not config:
return
......@@ -83,6 +102,8 @@ def main():
for _, options in config["checks"].items():
module = options["module"]
for name, args in options.get("runs").items():
if probes_to_run and name not in probes_to_run:
continue
command = ["python3", "-m", module]
timeout = global_timeout
if args is not None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment