| Total Complexity | 2 |
| Total Lines | 16 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | from libcloud.container.utils.docker import HubClient |
||
| 10 | class DeployContainerAction(BaseAction): |
||
| 11 | api_type = 'container' |
||
| 12 | |||
| 13 | def run(self, credentials, name, repository_name, tag, |
||
| 14 | start, cluster_id=None, parameters=None): |
||
| 15 | driver = self._get_driver_for_credentials(credentials=credentials) |
||
| 16 | hub_client = HubClient() |
||
| 17 | image = hub_client.get_image(repository_name, tag) |
||
| 18 | if cluster_id is not None: |
||
| 19 | cluster = driver.get_cluster(cluster_id) |
||
| 20 | else: |
||
| 21 | cluster = None |
||
| 22 | record = driver.deploy_container(name=name, image=image, |
||
| 23 | start=start, cluster=cluster, |
||
| 24 | parameters=parameters) |
||
| 25 | return self.resultsets.formatter(record) |
||
| 26 |