# HG changeset patch # User Marcin Kuzminski # Date 2017-11-03 12:07:02 # Node ID 68955e56bd44034cf98abe4dc4075101080b8e95 # Parent dd78047247b767a1a196f0fb6e8bac4409c91321 ssh: prevent exceptions when user associated to stored old key is not found. diff --git a/rhodecode/apps/ssh_support/lib/backends/__init__.py b/rhodecode/apps/ssh_support/lib/backends/__init__.py --- a/rhodecode/apps/ssh_support/lib/backends/__init__.py +++ b/rhodecode/apps/ssh_support/lib/backends/__init__.py @@ -180,6 +180,11 @@ class SshWrapper(object): elif scm_detected: user = User.get(user_id) + if not user: + log.warning('User with id %s not found', user_id) + exit_code = -1 + return exit_code + auth_user = user.AuthUser() permissions = auth_user.permissions['repositories'] diff --git a/rhodecode/apps/ssh_support/lib/backends/base.py b/rhodecode/apps/ssh_support/lib/backends/base.py --- a/rhodecode/apps/ssh_support/lib/backends/base.py +++ b/rhodecode/apps/ssh_support/lib/backends/base.py @@ -83,8 +83,9 @@ class VcsServer(object): self.user, self.repo_name) return 0 - log.error('Cannot properly fetch or allow user permissions. ' - 'Return value is: %s, req action: %s', permission, action) + log.error('Cannot properly fetch or allow user %s permissions. ' + 'Return value is: %s, req action: %s', + self.user, permission, action) return -2 def update_environment(self, action, extras=None):