add logging for set_file_ssh_authorized_keys

This commit is contained in:
Jan Dittberner 2015-01-29 22:39:01 +01:00
parent 307ccf4307
commit 7dbb51da1a

View file

@ -336,6 +336,8 @@ def set_file_ssh_authorized_keys(username, ssh_keys):
stderr=subprocess.STDOUT)
subprocess.check_output([
SUDO_CMD, RM_CMD, filename], stderr=subprocess.STDOUT)
_LOGGER.info(
'set %d authorized_keys for user %s', len(ssh_keys), username)
except subprocess.CalledProcessError as cpe:
log_and_raise(
cpe, 'could not write authorized_keys file for user %s',
@ -346,6 +348,8 @@ def set_file_ssh_authorized_keys(username, ssh_keys):
SUDO_CMD, RM_CMD, '-rf',
os.path.dirname(ssh_authorized_keys_file)],
stderr=subprocess.STDOUT)
_LOGGER.info(
'deleted authorized_keys of user %s', username)
except subprocess.CalledProcessError as cpe:
log_and_raise(
cpe, 'could not remove the authorized_keys file of user %s',