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

CreateVlanAction.run()   A

Complexity

Conditions 1

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 16
rs 9.4285
1
from lib import actions
2
3
__all__ = [
4
    'CreateVlanAction',
5
]
6
7
8
class CreateVlanAction(actions.BaseAction):
9
10
    def run(self, **kwargs):
11
        action = kwargs['action']
12
        del kwargs['action']
13
        region = kwargs['region']
14
        del kwargs['region']
15
        network_domain_id = kwargs['network_domain_id']
16
        del kwargs['network_domain_id']
17
        driver = self._get_compute_driver(region)
18
        network_domain = driver.ex_get_network_domain(network_domain_id)
19
        kwargs['network_domain'] = network_domain
20
        result = self._do_function(driver, action, **kwargs)
21
        # Wait to complete
22
        driver.ex_wait_for_state('NORMAL', driver.ex_get_vlan,
23
                                 poll_interval=2, timeout=1200,
24
                                 vlan_id=result['id'])
25
        return result
26