Skip to content

Commit 974573a

Browse files
author
Alexandre Vincent
committed
[change] More meaningful message on CommandTimeoutException
1 parent 53bf4f0 commit 974573a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

openwisp_controller/connection/connectors/ssh.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def _connect(self, address):
149149
auth_timeout=app_settings.SSH_AUTH_TIMEOUT,
150150
banner_timeout=app_settings.SSH_BANNER_TIMEOUT,
151151
timeout=app_settings.SSH_CONNECTION_TIMEOUT,
152-
**params
152+
**params,
153153
)
154154
except paramiko.ssh_exception.AuthenticationException as e:
155155
# the authentication failure may be caused by the issue
@@ -207,7 +207,7 @@ def exec_command(
207207
if not stdout.channel.status_event.wait(
208208
timeout=timeout - (time.perf_counter() - start_cmd)
209209
):
210-
log_message = "Command timeout exceeded."
210+
log_message = f"Command timed out after {timeout} seconds."
211211
logger.info(log_message)
212212
raise CommandTimeoutException(log_message)
213213

openwisp_controller/connection/tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def launch_command(command_id):
7979
command.save()
8080
except CommandTimeoutException as e:
8181
command.status = "failed"
82-
command._add_output(_(f"{e}"))
82+
command._add_output(_(f"The command took longer than expected: {e}"))
8383
command.save()
8484
except Exception as e:
8585
logger.exception(

0 commit comments

Comments
 (0)