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