Skip to content

Commit c49acc7

Browse files
dbasunagkpunwatk
andcommitted
Add a timeout to run_command() so that must-gather collection does not hang (#750)
Co-authored-by: Karishma Punwatkar <kpunwatk@redhat.com>
1 parent 4df63ce commit c49acc7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

utilities/must_gather_collector.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,19 @@ def run_must_gather(
8383
since: str = "1m",
8484
component_name: str = "",
8585
namespaces_dict: dict[str, str] | None = None,
86+
timeout: int = 900,
8687
) -> str:
8788
"""
8889
Process the arguments to build must-gather command and run the same
8990
9091
Args:
9192
image_url (str): must-gather image url
9293
target_dir (str): must-gather target directory
93-
since (str): duration in seconds for must-gather log collection
94+
since (str): duration in seconds -s, minutes -m for must-gather log collection
9495
component_name (str): must-gather component name
9596
namespaces_dict (dict[str, str] | None): namespaces dict for extra data collection from different component
9697
namespaces
98+
timeout (int): timeout in seconds for must-gather command execution
9799
98100
Returns:
99101
str: must-gather output
@@ -130,7 +132,7 @@ def run_must_gather(
130132
namespace_str += f"export AUTH_NS={shlex.quote(namespaces_dict['auth'])};"
131133
must_gather_command += f" -- '{namespace_str} /usr/bin/gather'"
132134

133-
return run_command(command=shlex.split(must_gather_command), check=False)[1]
135+
return run_command(command=shlex.split(must_gather_command), check=False, timeout=timeout)[1]
134136

135137

136138
def get_must_gather_image_info() -> str:

0 commit comments

Comments
 (0)