From eb310ac267d601f101e96fd0b379c5bdfc2e772f Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Sep 27 2015 19:22:20 +0000 Subject: Adjust update_user_ssh to always write the key and drop the returned message The way this function is called is such that checking if the key provided is the same as the key in place does not actually make sense. So we'll just update the key in place with the provided one and adjust it in the filesystem as well. --- diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index 7ba6349..b42fe42 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -1851,18 +1851,11 @@ def update_user_ssh(session, user, ssh_key, keydir): if isinstance(user, basestring): user = __get_user(session, user) - message = 'Nothing to update' - - if ssh_key != user.public_ssh_key: - user.public_ssh_key = ssh_key - if keydir: - create_user_ssh_keys_on_disk(user, keydir) - pagure.lib.git.generate_gitolite_acls() - session.add(user) - session.flush() - message = 'Public ssh key updated' - - return message + user.public_ssh_key = ssh_key + if keydir and user.public_ssh_key: + create_user_ssh_keys_on_disk(user, keydir) + session.add(user) + session.flush() def avatar_url(username, size=64, default='retro'):