Browse code

preserve ownership when synchronizing from s3 to local

seneque authored on 2013/07/25 21:35:22
Showing 1 changed files
... ...
@@ -887,7 +887,10 @@ def cmd_sync_remote2local(args):
887 887
                             mtime = attrs.has_key('mtime') and int(attrs['mtime']) or int(time.time())
888 888
                             atime = attrs.has_key('atime') and int(attrs['atime']) or int(time.time())
889 889
                             os.utime(dst_file, (atime, mtime))
890
-                        ## FIXME: uid/gid / uname/gname handling comes here! TODO
890
+                        if attrs.has.key('uid') and attrs.has.key('gid'):
891
+                            uid = int(attrs['uid'])
892
+                            gid = int(attrs['gid'])
893
+                            os.lchown(dst_file,uid,gid)				
891 894
                 except OSError, e:
892 895
                     try:
893 896
                         dst_stream.close()