Completed
Push — master ( 591bf0...c4b659 )
by Edward
01:58
created

ConsulBaseAction._get_client()   A

Complexity

Conditions 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 7
rs 9.4285
1
from st2actions.runners.pythonrunner import Action
2
3
# http://python-consul.readthedocs.org/en/latest/#
4
import consul
5
6
7
class ConsulBaseAction(Action):
8
9
    def __init__(self, config):
10
        super(ConsulBaseAction, self).__init__(config)
11
        self.consul = self._get_client()
12
13
    def _get_client(self):
14
        host = self.config['host']
15
        port = self.config['port']
16
        token = self.config['token']
17
18
        client = consul.Consul(host, port, token)
19
        return client
20