Total Complexity | 2 |
Total Lines | 16 |
Duplicated Lines | 0 % |
1 | from lib.actions import BaseAction |
||
8 | class DestroyContainerAction(BaseAction): |
||
9 | api_type = 'container' |
||
10 | |||
11 | def run(self, credentials, container_id): |
||
12 | driver = self._get_driver_for_credentials(credentials=credentials) |
||
13 | container = driver.get_container(container_id) |
||
14 | |||
15 | self.logger('Destroying container: %s...' % (container)) |
||
16 | status = driver.destroy_container(container) |
||
17 | |||
18 | if status is True: |
||
19 | self.logger.info('Successfully destroyed container "%s"' % (container)) |
||
20 | else: |
||
21 | self.logger.error('Failed to destroy container "%s"' % (container)) |
||
22 | |||
23 | return status |
||
24 |