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

Icinga2Action   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 39
Duplicated Lines 0 %
Metric Value
wmc 10
dl 0
loc 39
rs 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A get_client() 0 3 1
A get_error() 0 2 1
A set_body() 0 2 1
A run() 0 2 1
A get_method() 0 2 1
A __init__() 0 9 1
A set_method() 0 2 1
A get_body() 0 2 1
A set_path() 0 2 1
A get_path() 0 2 1
1
from st2actions.runners.pythonrunner import Action
2
from lib.client import Client
0 ignored issues
show
Bug introduced by
The name client does not seem to exist in module lib.
Loading history...
3
import sys
0 ignored issues
show
Unused Code introduced by
The import sys seems to be unused.
Loading history...
4
5
class Icinga2Action(Action):
6
7
    def __init__(self, config):
8
        super(Icinga2Action, self).__init__(config)
9
        self.body = ''
10
        self.error = 0
11
        self.api_url = config['api_url']
12
        self.api_user = config['api_user']
13
        self.api_password = config['api_password']
14
        self.method = 'get'
15
        self.path = ''
16
17
    def run(self):
18
        pass
19
      
0 ignored issues
show
Coding Style introduced by
Trailing whitespace
Loading history...
20
    def get_client(self):
21
        client = Client(self, self.api_url + self.path, self.api_user, self.api_password, self.method)
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (102/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
22
        return client
23
24
    def get_error(self):
25
        return self.error
26
    
0 ignored issues
show
Coding Style introduced by
Trailing whitespace
Loading history...
27
    def get_body(self):
28
        return self.body
29
30
    def set_body(self, body):
31
        self.body = body
32
    
0 ignored issues
show
Coding Style introduced by
Trailing whitespace
Loading history...
33
    def set_method(self, method):
34
        self.method = method
35
    
0 ignored issues
show
Coding Style introduced by
Trailing whitespace
Loading history...
36
    def get_method(self):
37
        return self.method
38
    
0 ignored issues
show
Coding Style introduced by
Trailing whitespace
Loading history...
39
    def set_path(self, path):
40
        self.path = path
41
    
0 ignored issues
show
Coding Style introduced by
Trailing whitespace
Loading history...
42
    def get_path(self):
43
        return self.path
44