Total Complexity | 5 |
Total Lines | 22 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | from st2actions.runners.pythonrunner import Action |
||
5 | class ClicrudWrite(Action): |
||
6 | |||
7 | def run(self, **kwargs): |
||
8 | _args = kwargs |
||
9 | commands = kwargs.pop('commands') |
||
10 | |||
11 | # If port is not specified, ST2 passes it is as None |
||
12 | # This breaks clicrud, so better to remove it here |
||
13 | if kwargs.get('port'): |
||
14 | if kwargs['port'] is None: |
||
15 | kwargs.pop('port') |
||
16 | |||
17 | # Same issue with enable |
||
18 | if kwargs.get('enable'): |
||
19 | if kwargs['enable'] is None: |
||
20 | kwargs.pop('enable') |
||
21 | |||
22 | transport = generic(**kwargs) |
||
23 | |||
24 | response = transport.configure(commands) |
||
25 | transport.close() |
||
26 | return response |
||
27 |