backend/server/rhnServer/server_lib.py | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
New commits:
commit 5d7cbc0e2ac44b69c6dd8ed652bd85f572e95ef9
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Thu Feb 3 18:13:36 2011 +0100
590608 - nullify jabber_ids from previous registrations
This fix is to ensure push functionality will be functional after
system's re-registration.
Couple of things adding to the problem:
* after system re-registration, systemid changes, jabber_id stays
* rhnPushClient table with multiple rows with identical jabber_id
and different server_id
* osa-dispatcher tries to find shared key for given jabber_id, backend
simply returns the first row fetched (now with an invalid shared key)
* signatures computed by osad and osa-dispatcher do not match -> osad
won't do anything
* deleting the older servers in webui won't help
diff --git a/backend/server/rhnServer/server_lib.py
b/backend/server/rhnServer/server_lib.py
index fa96a61..e47df37 100644
--- a/backend/server/rhnServer/server_lib.py
+++ b/backend/server/rhnServer/server_lib.py
@@ -349,6 +349,13 @@ def update_push_client_registration(server_id):
# Autonomous transaction, so no need to commit
return timestamp, client_name, shared_key
+_query_delete_duplicate_client_jids = rhnSQL.Statement("""
+ update rhnPushClient
+ set jabber_id = null
+ where jabber_id = :jid and
+ server_id <> :server_id
+""")
+
_query_update_push_client_jid = rhnSQL.Statement("""
update rhnPushClient
set jabber_id = :jid,
@@ -356,9 +363,12 @@ _query_update_push_client_jid = rhnSQL.Statement("""
last_ping_time = NULL
where server_id = :server_id
""")
+
def update_push_client_jid(server_id, jid):
- h = rhnSQL.prepare(_query_update_push_client_jid)
- h.execute(server_id=server_id, jid=jid)
+ h1 = rhnSQL.prepare(_query_delete_duplicate_client_jids)
+ h1.execute(server_id=server_id, jid=jid)
+ h2 = rhnSQL.prepare(_query_update_push_client_jid)
+ h2.execute(server_id=server_id, jid=jid)
rhnSQL.commit()
return jid
Show replies by date