Ubuntu Pastebin

Paste from bdx at Thu, 14 Jul 2016 17:08:34 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
@when('nginx.available')
@when('kibana.initialized')
@when('elasticsearch.available')
def elastic_search_available(elasticsearch):
    hookenv.status_set('maintenance',
                       'Configuring kibana for elasticsearch')
    ES_SERVERS = []
    for unit in elasticsearch.list_unit_data():
        ES_SERVERS.append({'host': unit['host'], 'port': unit['port']})

    # Configure nginx for es_cluster
    configure_site('es_cluster', 'es_cluster.conf', es_servers=ES_SERVERS)

    # Open elastic search port
    hookenv.open_port(9200)

    # Restart kibana 
    service_restart('kibana')
    hookenv.status_set('active',
                       'kibana available')
    # Set state
    set_state('kibana.available')
Download as text