Exemplo n.º 1
0
def test_read_conf():
    #XXX:dc: this only passes when you run it from the top level project
    # directory
    local_path = getcwd()
    conf = Config()
    with open(join(local_path, 'tests/fixtures/config.yaml')) as conf_file:
        conf.load(conf_file)
Exemplo n.º 2
0
def test_simple_config():
    conf = Config()
    conf.load(simple_config)
    assert conf.redis_host == 'localhost'
    assert conf.redis_port == 6379
    assert conf.queue_key == 'incoming'
    assert conf.alert_time == 0.5
    assert conf.timeslices == [300]
    assert conf.error_signatures == {
            'Test Error': {
                'signatures':
                    {'threshold': 0.5, 'sig': 'Test Error'},
                'alert_thresholds': {'high': 1000, 'med': 100, 'low': 10}
                }
            }
Exemplo n.º 3
0
def main():
    parser = OptionParser(usage='usage: firetower options args')
    parser.add_option(
        '-c', '--conf', action='store', dest='conf_path',
         help='Path to YAML configuration file.')

    (options, args) = parser.parse_args()

    if len(args) > 1:
        parser.error('Please supply some arguments')

    conf = Config()
    with open(options.conf_path) as conf_file:
        conf.load(conf_file)

    main = Client()
    main.run(conf)