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.

NagiosMessageEventHandler   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 43
ccs 0
cts 15
cp 0
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
B handle() 0 37 3
1
"""
2
Enarksh
3
4
Copyright 2013-2016 Set Based IT Consultancy
5
6
Licence MIT
7
"""
8
import logging
9
10
from enarksh.C import C
11
from enarksh.DataLayer import DataLayer
12
from enarksh.controller.event_handler.NodeActionMessageBaseEventHandler import NodeActionMessageBaseEventHandler
13
14
15
class NagiosMessageEventHandler(NodeActionMessageBaseEventHandler):
16
    """
17
    An event handler for a NagiosMessage received events.
18
    """
19
20
    # ------------------------------------------------------------------------------------------------------------------
21
    @staticmethod
22
    def handle(_event, _message, controller):
23
        """
24
        Handles a NagiosMessage received event.
25
26
        :param * _event: Not used.
27
        :param * _message: Not used.
28
        :param enarksh.controller.Controller.Controller controller: The controller.
29
        """
30
        del _event, _message
31
32
        log = logging.getLogger('enarksh')
33
34
        rst_count = {C.ENK_RST_ID_COMPLETED: 0,
35
                     C.ENK_RST_ID_ERROR:     0,
36
                     C.ENK_RST_ID_QUEUED:    0,
37
                     C.ENK_RST_ID_RUNNING:   0,
38
                     C.ENK_RST_ID_WAITING:   0}
39
40
        response = {'ret':       0,
41
                    'rst_count': rst_count,
42
                    'sch_count': len(controller.schedules)}
43
44
        try:
45
            for schedule in controller.schedules.values():
46
                schedule.nagios_performance_data(rst_count)
47
48
        except Exception as exception:
49
            log.exception('Error')
50
51
            response['ret'] = -1
52
            response['message'] = str(exception)
53
54
            DataLayer.rollback()
55
56
        # Send response message to the CLI client.
57
        controller.message_controller.send_message('lockstep', response)
58
59
# ----------------------------------------------------------------------------------------------------------------------
60