|
4 | 4 | import os |
5 | 5 | import random |
6 | 6 | import re |
7 | | -import signal |
8 | 7 | import shutil |
| 8 | +import signal |
9 | 9 | import tempfile |
10 | 10 | import time |
11 | 11 | import traceback |
|
18 | 18 | Dict, |
19 | 19 | List, |
20 | 20 | Optional, |
21 | | - Union, |
22 | 21 | Tuple, |
23 | 22 | Type, |
| 23 | + Union, |
24 | 24 | ) |
25 | 25 |
|
26 | 26 | from billiard.exceptions import SoftTimeLimitExceeded |
27 | 27 | from filelock import FileLock |
28 | 28 | from mako.lookup import TemplateLookup |
29 | | -from plumbum import local, ProcessExecutionError, ProcessTimedOut |
| 29 | +from plumbum import ProcessExecutionError, ProcessTimedOut, local |
| 30 | +from sentry_sdk import capture_message |
30 | 31 |
|
31 | 32 | from alts.shared.constants import COMMAND_TIMEOUT_EXIT_CODE |
32 | 33 | from alts.shared.exceptions import ( |
@@ -599,6 +600,7 @@ def run_ansible_command( |
599 | 600 | stderr = f'Timeout occurred when running ansible command: "{formulated_cmd}"' |
600 | 601 | exit_code = COMMAND_TIMEOUT_EXIT_CODE |
601 | 602 | exception_happened = True |
| 603 | + capture_message(stderr) |
602 | 604 | except Exception as e: |
603 | 605 | self._logger.error( |
604 | 606 | 'Unknown error happened during %s execution: %s', |
@@ -759,7 +761,7 @@ def initial_provision(self, verbose=False): |
759 | 761 | ) |
760 | 762 | if exit_code == COMMAND_TIMEOUT_EXIT_CODE: |
761 | 763 | return 1, '', f'Provision has timed out: {out}\n{err}' |
762 | | - elif exit_code != 0: |
| 764 | + if exit_code != 0: |
763 | 765 | return 1, '', f'Provision exited abnormally: {out}\n{err}' |
764 | 766 | return exit_code, out, err |
765 | 767 |
|
|
0 commit comments