Completed
Pull Request — master (#415)
by Anthony
13:50
created

AttachNodeToVlanAction.run()   A

Complexity

Conditions 1

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 15
rs 9.4285
1
from lib import actions
2
3
__all__ = [
4
    'AttachNodeToVlanAction',
5
]
6
7
8
class AttachNodeToVlanAction(actions.BaseAction):
9
10
    def run(self, **kwargs):
11
        node_id = kwargs['node_id']
12
        del kwargs['node_id']
13
        action = kwargs['action']
14
        del kwargs['action']
15
        region = kwargs['region']
16
        del kwargs['region']
17
        vlan_id = kwargs['vlan_id']
18
        del kwargs['vlan_id']
19
        driver = self._get_compute_driver(region)
20
        node = driver.ex_get_node_by_id(node_id)
21
        vlan = driver.ex_get_vlan(vlan_id)
22
        kwargs['node'] = node
23
        kwargs['vlan'] = vlan
24
        return self._do_function(driver, action, **kwargs)
25