Completed
Pull Request — master (#415)
by Anthony
02:10
created

GetImageByNameAction   A

Complexity

Total Complexity 2

Size/Duplication

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 7 2
1
from lib import actions
2
3
__all__ = [
4
    'GetImageByNameAction',
5
]
6
7
8
class GetImageByNameAction(actions.BaseAction):
9
10
    def run(self, region, location, image_name):
11
        driver = self._get_compute_driver(region)
12
        location = driver.ex_get_location_by_id(location)
13
        images = driver.list_images(location=location)
14
        image = list(filter(lambda x: x.name == image_name,
15
                            images))[0]
16
        return self.resultsets.formatter(image)
17