-
Notifications
You must be signed in to change notification settings - Fork 5
/
notifier.py
31 lines (22 loc) · 919 Bytes
/
notifier.py
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
28
29
30
31
# -*- coding: utf-8 -*-
# Copyright 2018-2019 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later
from xivo_bus.resources.context_context.event import ContextContextsAssociatedEvent
from xivo_confd import bus, sysconfd
class ContextContextNotifier(object):
def __init__(self, bus, sysconfd):
self.bus = bus
self.sysconfd = sysconfd
def send_sysconfd_handlers(self):
handlers = {
'ipbx': ['dialplan reload'],
'agentbus': [],
}
self.sysconfd.exec_request_handlers(handlers)
def associated_contexts(self, context, contexts):
self.send_sysconfd_handlers()
context_ids = [context.id for context in contexts]
event = ContextContextsAssociatedEvent(context.id, context_ids)
self.bus.send_bus_event(event)
def build_notifier():
return ContextContextNotifier(bus, sysconfd)