Completed
Pull Request — master (#564)
by
unknown
02:19
created

ActionWrapper   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 10
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A run() 0 6 1
A __init__() 0 2 1
1
import importlib
2
from st2actions.runners.pythonrunner import Action
3
4
5
class ActionWrapper(Action):
6
    def __init__(self, config):
7
        self.config = config
8
9
    def run(self, **kwargs):
10
        cls_name = kwargs.pop("cls")
11
        module_path = kwargs.pop("module_path")
12
        module = importlib.import_module(module_path)
13
        cls = getattr(module, cls_name)(self.config)
14
        return cls.run(**kwargs)
15