Completed
Pull Request — master (#364)
by Anthony
02:12
created

StartContainerAction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %
Metric Value
dl 0
loc 16
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 13 2
1
from lib.actions import BaseAction
2
3
__all__ = [
4
    'StartContainerAction'
5
]
6
7
8
class StartContainerAction(BaseAction):
9
    api_type = 'container'
10
11
    def run(self, credentials, container_id):
12
        self._get_driver_for_credentials(credentials=credentials)
13
        container = self.get_container(container_id)
14
15
        self.logger.info('Starting container: %s' % (container))
16
        status = container.start()
17
18
        if status is True:
19
            self.logger.info('Successfully started container "%s"' % (container))
20
        else:
21
            self.logger.error('Failed to start container "%s"' % (container))
22
23
        return status
24