| 377 | return True |
| 378 | |
| 379 | def handle_exception(self, msg, exc): |
| 380 | if isinstance(exc, SaltCloudException): |
| 381 | # It's a known exception and we know how to handle it |
| 382 | if isinstance(exc, SaltCloudSystemExit): |
| 383 | # This is a salt cloud system exit |
| 384 | if exc.exit_code > 0: |
| 385 | # the exit code is bigger than 0, it's an error |
| 386 | msg = f"Error: {msg}" |
| 387 | self.exit(exc.exit_code, msg.format(exc).rstrip() + "\n") |
| 388 | # It's not a system exit but it's an error we can |
| 389 | # handle |
| 390 | self.error(msg.format(exc)) |
| 391 | # This is a generic exception, log it, include traceback if |
| 392 | # debug logging is enabled and exit. |
| 393 | log.error( |
| 394 | msg.format(exc), |
| 395 | # Show the traceback if the debug logging level is |
| 396 | # enabled |
| 397 | exc_info_on_loglevel=logging.DEBUG, |
| 398 | ) |
| 399 | self.exit(salt.defaults.exitcodes.EX_GENERIC) |