Completed
Pull Request — master (#469)
by
unknown
02:24
created

Icinga2GetStatus.run()   A

Complexity

Conditions 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 10
rs 9.4285
cc 2
1
#!/usr/bin/env python
2
from lib.client import Client
3
from lib.icinga2action import Icinga2Action
4
import sys
5
6
class Icinga2GetStatus(Icinga2Action):
7
        
8
    def run(self):
9
        self.set_method('get')
10
        self.set_path('/status')
11
        self.logger.debug('Action Icinga2GetStatus started')
12
        client = self.get_client()
13
        client.make_call()
14
        if self.get_error() == 0:
15
            return self.get_body()
16
        else:
17
            sys.exit(self.get_error())
18