Esempio n. 1
0
def listen_for_checks(magpie):
    '''
    If im not the leader, and im not listening, then listen
    '''
    iperf = Iperf()
    iperf.listen()
    magpie.set_iperf_server_ready()
    set_state('iperf.listening')
Esempio n. 2
0
def listen(*args):
    action_config = hookenv.action_get()
    cidr = action_config.get('network-cidr')
    listener_count = action_config.get('listener-count') or 1
    magpie = reactive.relations.endpoint_from_flag('magpie.joined')
    iperf = Iperf()
    for port in range(IPERF_BASE_PORT, IPERF_BASE_PORT + int(listener_count)):
        iperf.listen(cidr=cidr, port=port)
    magpie.set_iperf_server_ready()
    reactive.set_state('iperf.listening')