diff options
author | Milo Casagrande <milo@ubuntu.com> | 2013-03-19 09:56:12 +0100 |
---|---|---|
committer | Milo Casagrande <milo@ubuntu.com> | 2013-03-19 09:56:12 +0100 |
commit | 7d3a9a82fcd8dce144638f6c4054410a8d42b2ef (patch) | |
tree | d0206d964b7541e15927885b8a2f78b0a924e90f | |
parent | a6035b2eb1f916d2fcaa71f42a8699a2427f1625 (diff) |
Catch error with symlinks, skip symlinks in case.
-rw-r--r-- | scripts/rsync-mirror | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/scripts/rsync-mirror b/scripts/rsync-mirror index ae54e40..17b6be2 100644 --- a/scripts/rsync-mirror +++ b/scripts/rsync-mirror @@ -95,11 +95,21 @@ def set_own_perm(): for root, dirs, files in os.walk(LOCAL_REPO_PATH): for ldir in dirs: dir_path = os.path.join(root, ldir) - os.chown(dir_path, usr, grp) - os.chmod(dir_path, dir_perm) + if os.path.islink(dir_path): + continue + try: + os.chown(dir_path, usr, grp) + os.chmod(dir_path, dir_perm) + except OSError, ex: + logger.error("Error setting ownership of %s." % dir_path) + logger.debug(ex) for f in files: file_path = os.path.join(root, f) - os.chown(file_path, usr, grp) + try: + os.chown(file_path, usr, grp) + except OSError, ex: + logger.error("Error setting ownership of %s." % file_path) + logger.debug(ex) def args_parser(): |