mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 23:02:19 +00:00
Updated logging for SSO tasks
This commit is contained in:
@@ -42,6 +42,7 @@ def update_user_access(user, **kwargs):
|
|||||||
access groups.
|
access groups.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
logger = update_user_access.get_logger()
|
||||||
user = User.objects.get(id=user)
|
user = User.objects.get(id=user)
|
||||||
|
|
||||||
# Create a list of all Corp and Alliance groups
|
# Create a list of all Corp and Alliance groups
|
||||||
@@ -115,25 +116,23 @@ def update_user_access(user, **kwargs):
|
|||||||
else:
|
else:
|
||||||
conn = urllib2.urlopen(req, timeout=5)
|
conn = urllib2.urlopen(req, timeout=5)
|
||||||
except (urllib2.HTTPError, urllib2.URLError) as e:
|
except (urllib2.HTTPError, urllib2.URLError) as e:
|
||||||
# logger.error('Error notifying SSO service: %s' % e.code, exc_info=sys.exc_info(), extra={'data': {'url': url}})
|
logger.error('Error notifying SSO service: %s' % e.code, exc_info=sys.exc_info(), extra={'data': {'url': url}})
|
||||||
pass
|
pass
|
||||||
else:
|
|
||||||
if settings.DEBUG:
|
|
||||||
print conn.read()
|
|
||||||
|
|
||||||
update_service_groups.delay(user_id=user.id)
|
update_service_groups.delay(user_id=user.id)
|
||||||
|
|
||||||
|
|
||||||
@task(ignore_result=True)
|
@task(ignore_result=True)
|
||||||
def update_service_groups(user_id):
|
def update_service_groups(user_id):
|
||||||
|
logger = update_service_groups.get_logger()
|
||||||
for service in ServiceAccount.objects.filter(user=user_id, active=True).select_related('service__api'):
|
for service in ServiceAccount.objects.filter(user=user_id, active=True).select_related('service__api'):
|
||||||
api = service.service.api_class
|
api = service.service.api_class
|
||||||
try:
|
try:
|
||||||
print "Updating %s" % service
|
print "Updating %s" % service
|
||||||
api.update_groups(service.service_uid, service.user.groups.all(), service.character)
|
api.update_groups(service.service_uid, service.user.groups.all(), service.character)
|
||||||
print "Done"
|
logger.debug("Service %s (%s) Updated" % (service.service, service.service_uid))
|
||||||
except:
|
except Exception as e:
|
||||||
print "Error updating %s %s" % (service.service, service.service_uid)
|
logger.error("Error updating Service %s (%s) - %s" % (service.service, service.service_uid, e), exc_info=sys.exc_info(), extra={'service': service.service, 'service_uid': service.service_uid})
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user