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

GetNetworkByNameAction.run()   A

Complexity

Conditions 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 2
dl 0
loc 6
rs 9.4285
1
from lib import actions
2
3
__all__ = [
4
    'GetNetworkByNameAction',
5
]
6
7
8
class GetNetworkByNameAction(actions.BaseAction):
9
10
    def run(self, region, network_name):
11
        driver = self._get_compute_driver(region)
12
        networks = driver.ex_list_networks()
13
        network = list(filter(lambda x: x.name == network_name,
14
                              networks))[0]
15
        return self.resultsets.formatter(network)
16