~michael.nelson/charms/trusty/logstash/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/python

import os
import sys

sys.path.insert(0, os.path.join(os.environ['CHARM_DIR'], 'lib'))

from charmhelpers.core import (
    hookenv,
)

hooks = hookenv.Hooks()
log = hookenv.log

SERVICE = 'logstash-indexer'
BASEPATH = '/opt/logstash'


@hooks.hook('client-relation-joined')
def client_relation_joined():
    hookenv.relation_set(hookenv.relation_id(),
                         {'cluster-name': 'elasticsearch',
                          'host': 'foo'})

if __name__ == "__main__":
    # execute a hook based on the name the program is called by
    hooks.execute(sys.argv)