Skip to content

Commit bde73cc

Browse files
Add default 15 second timeout to pebble exec (#394)
Fixes #393
1 parent dc289d7 commit bde73cc

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

src/container.py

+5-9
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,11 @@ def set_mysql_router_rest_api_password(
228228
self.create_router_rest_api_credentials_file()
229229

230230
if not password:
231-
users_credentials = self._run_command(
232-
[
233-
self._mysql_router_password_command,
234-
"list",
235-
str(self.rest_api_credentials_file),
236-
],
237-
timeout=30,
238-
)
231+
users_credentials = self._run_command([
232+
self._mysql_router_password_command,
233+
"list",
234+
str(self.rest_api_credentials_file),
235+
])
239236
if user not in users_credentials:
240237
return
241238

@@ -248,5 +245,4 @@ def set_mysql_router_rest_api_password(
248245
user,
249246
],
250247
input=password,
251-
timeout=30,
252248
)

src/rock.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def _run_command(
235235
self,
236236
command: typing.List[str],
237237
*,
238-
timeout: typing.Optional[int],
238+
timeout: typing.Optional[int] = 15,
239239
input: str = None, # noqa: A002 Match subprocess.run()
240240
) -> str:
241241
try:

src/workload.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def _bootstrap_router(self, *, event, tls: bool) -> None:
266266

267267
command = self._get_bootstrap_command(event=event, connection_info=self._connection_info)
268268
try:
269-
self._container.run_mysql_router(command, timeout=30)
269+
self._container.run_mysql_router(command)
270270
except container.CalledProcessError as e:
271271
# Original exception contains password
272272
# Re-raising would log the password to Juju's debug log

0 commit comments

Comments
 (0)