Completed
Push — master ( 85147e...d9066e )
by Tomaz
03:35
created

SoftlayerBaseAction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 2
1
from libcloud.compute.providers import Provider
2
from libcloud.compute.providers import get_driver
3
from st2actions.runners.pythonrunner import Action
4
5
6
class SoftlayerBaseAction(Action):
7
    def __init__(self, config):
8
        # Handy translation from our parameters to libcloud ones
9
        self.st2_to_libcloud = {
10
            "domain": "ex_domain",
11
            "os": "ex_os",
12
            "ram": "ex_ram",
13
            "disk": "ex_disk",
14
            "cpus": "ex_cpus",
15
            "bandwith": "ex_bandwidth",
16
            "local_disk": "ex_local_disk",
17
            "datacenter": "ex_datacenter",
18
            "keyname": "ex_keyname"
19
        }
20
        super(SoftlayerBaseAction, self).__init__(config=config)
21
22
    def _get_driver(self):
23
        cls = get_driver(Provider.SOFTLAYER)
24
        return cls(self.config['username'], self.config['api_key'])
25