Execute one of the available commands. Args: command: Command in self.commands.
(self, command: str)
| 47 | ) |
| 48 | |
| 49 | def run(self, command: str) -> None: |
| 50 | """Execute one of the available commands. |
| 51 | |
| 52 | Args: |
| 53 | command: Command in self.commands. |
| 54 | """ |
| 55 | boto3.setup_default_session(region_name=self._config.aws_region) |
| 56 | |
| 57 | # Validate the configuration. |
| 58 | try: |
| 59 | if command not in {'clone_rules', 'compile_rules', 'configure', 'unit_test'}: |
| 60 | self._config.validate() |
| 61 | getattr(self, command)() # Command validation already happened in the ArgumentParser. |
| 62 | except InvalidConfigError as error: |
| 63 | sys.exit('ERROR: {}\nPlease run "python3 manage.py configure"'.format(error)) |
| 64 | except TestFailureError as error: |
| 65 | sys.exit('TEST FAILED: {}'.format(error)) |
| 66 | |
| 67 | @staticmethod |
| 68 | def _enqueue( |