Conditions | 4 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | """ |
||
25 | def handle(self): |
||
26 | """ |
||
27 | Executes the request node action command. |
||
28 | """ |
||
29 | self.output = EnarkshStyle(self.input, self.output) |
||
30 | |||
31 | action = self.input.get_argument('action') |
||
32 | if action == 'trigger': |
||
33 | act_id = enarksh.ENK_ACT_ID_TRIGGER |
||
34 | elif action == 'restart': |
||
35 | act_id = enarksh.ENK_ACT_ID_RESTART |
||
36 | elif action == 'restart_failed': |
||
37 | act_id = enarksh.ENK_ACT_ID_RESTART_FAILED |
||
38 | else: |
||
39 | raise RuntimeError("Unknown action '{}'".format(action)) |
||
40 | |||
41 | uri = self.input.get_argument('uri') |
||
42 | |||
43 | client = NodeActionClient() |
||
44 | ret = client.main(uri, act_id) |
||
45 | |||
46 | return ret |
||
47 | |||
49 |