summaryrefslogtreecommitdiff
path: root/test/nagios/support/config.py
blob: afb4464ed380b907c81453413815ced3b5eb2a69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import yaml

class Config():
    def __init__(self, filename="/etc/leap/hiera.yaml"):
        with open("/etc/leap/hiera.yaml", 'r') as stream:
            config = yaml.load(stream)
        self.user = config['webapp']['nagios_test_user']
        if 'username' not in self.user:
            raise Exception('nagios test user lacks username')
        if 'password' not in self.user:
            raise Exception('nagios test user lacks password')
        self.api = config['api']
        self.api['version'] = config['webapp']['api_version']