mirror of
https://github.com/ansible/awx.git
synced 2026-07-04 21:10:09 -02:30
added model for holding channel group information, updating asgi_amsqp req
This commit is contained in:
@@ -7,7 +7,6 @@ from channels.sessions import channel_session
|
||||
def discard_groups(message):
|
||||
if 'groups' in message.channel_session:
|
||||
for group in message.channel_session['groups']:
|
||||
print("removing from group: {}".format(group))
|
||||
Group(group).discard(message.reply_channel)
|
||||
|
||||
@channel_session
|
||||
@@ -16,9 +15,7 @@ def ws_disconnect(message):
|
||||
|
||||
@channel_session
|
||||
def ws_receive(message):
|
||||
print(message)
|
||||
raw_data = message.content['text']
|
||||
print(raw_data)
|
||||
data = json.loads(raw_data)
|
||||
|
||||
if 'groups' in data:
|
||||
@@ -29,16 +26,14 @@ def ws_receive(message):
|
||||
if type(v) is list:
|
||||
for oid in v:
|
||||
name = '{}-{}'.format(group_name, oid)
|
||||
print("listening to group: {}".format(name))
|
||||
current_groups.append(name)
|
||||
Group(name).add(message.reply_channel)
|
||||
else:
|
||||
print("listening to group: {}".format(group_name))
|
||||
current_groups.append(group_name)
|
||||
Group(group_name).add(message.reply_channel)
|
||||
message.channel_session['groups'] = current_groups
|
||||
|
||||
|
||||
def emit_channel_notification(group, payload):
|
||||
print("sending message to group {}".format(group))
|
||||
payload = json.dumps(payload)
|
||||
Group(group).send({"text": json.dumps(payload)})
|
||||
|
||||
Reference in New Issue
Block a user