Skip to content
Snippets Groups Projects
Commit f95910f7 authored by Kevin S. Hahn's avatar Kevin S. Hahn
Browse files

make sure the instance always knows about itself

parent 6bf794b2
No related branches found
No related tags found
No related merge requests found
......@@ -73,6 +73,8 @@ elif not args.central_uri:
else:
fail_count = 0
application.db.sites.update({'_id': args.site_id}, {'_id': args.site_id, 'name': args.site_name, 'api_uri': args.api_uri, 'onload': True}, upsert=True)
@uwsgidecorators.timer(60)
def centralclient_timer(signum):
global fail_count
......@@ -83,4 +85,4 @@ else:
if fail_count == 3:
log.debug('scitran central unreachable, purging all remotes info')
centralclient.clean_remotes(application.db)
centralclient.clean_remotes(application.db, args.site_id)
......@@ -75,10 +75,10 @@ def update(db, api_uri, site_name, site_id, ssl_cert, central_url):
return False
def clean_remotes(db):
def clean_remotes(db, site_id):
"""Remove db.sites, and removes remotes field from all db.users."""
log.debug('removing remotes from users, and remotes collection')
db.sites.remove({})
db.sites.remove({'_id': {'$ne': [site_id]}})
db.users.update({'remotes': {'$exists': True}}, {'$unset': {'remotes': ''}}, multi=True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment