GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( fac2c4...4a4d5a )
by P.R.
03:39
created

NodeActionCommand.handle()   B

Complexity

Conditions 4

Size

Total Lines 22

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
c 1
b 0
f 0
dl 0
loc 22
ccs 0
cts 14
cp 0
crap 20
rs 8.9197
1
"""
2
Enarksh
3
4
Copyright 2013-2016 Set Based IT Consultancy
5
6
Licence MIT
7
"""
8
from cleo import Command
9
10
import enarksh
11
from enarksh.controller.client.NodeActionClient import NodeActionClient
12
from enarksh.style.EnarkshStyle import EnarkshStyle
13
14
15
class NodeActionCommand(Command):
16
    """
17
    Requests the controller for a node action
18
19
    node_action
20
        {uri : The URI of the node}
21
        {action : The action: trigger, restart, or restart_failed}
22
    """
23
24
    # ------------------------------------------------------------------------------------------------------------------
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
48
# ----------------------------------------------------------------------------------------------------------------------
49