From 3531fbdb29947e0b1d3707059730e615f6bf2495 Mon Sep 17 00:00:00 2001 From: Oleg Date: Wed, 8 May 2013 01:20:38 +0200 Subject: [PATCH] fix for authorized_key: skip chown and chmod if authorized_key_file is link --- library/system/authorized_key | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/library/system/authorized_key b/library/system/authorized_key index 0f9f4a6c895..26d844155eb 100644 --- a/library/system/authorized_key +++ b/library/system/authorized_key @@ -140,8 +140,12 @@ def keyfile(module, user, write=False, path=None, manage_dir=True): if module.selinux_enabled(): module.set_default_selinux_context(keysfile, False) - os.chown(keysfile, uid, gid) - os.chmod(keysfile, 0600) + try: + os.chown(keysfile, uid, gid) + os.chmod(keysfile, 0600) + except OSError: + pass + return keysfile def readkeys(filename):