This function is used to get the error message based on exit code.
(cmd, error_code)
| 47 | |
| 48 | |
| 49 | def get_error_msg(cmd, error_code): |
| 50 | """ |
| 51 | This function is used to get the error message based on exit code. |
| 52 | """ |
| 53 | error_str = '' |
| 54 | # Get the Utility from the cmd. |
| 55 | for utility in UTILITIES_ARRAY: |
| 56 | if utility in cmd: |
| 57 | error_str = utility + _(': error: ') |
| 58 | break |
| 59 | |
| 60 | try: |
| 61 | error_str = error_str + BG_PROCESS_ERROR_MSGS[error_code] |
| 62 | except KeyError: |
| 63 | error_str = (error_str + _('utility failed with exit code: ') + |
| 64 | str(error_code)) |
| 65 | |
| 66 | return error_str |
| 67 | |
| 68 | |
| 69 | def get_current_time(format='%Y-%m-%d %H:%M:%S.%f %z'): |