4520: tested copying, fixed bad 'properties' field
authorPeter Amstutz <peter.amstutz@clinicalfuture.com>
Tue, 17 Feb 2015 21:04:38 +0000 (21:04 +0000)
committerPeter Amstutz <peter.amstutz@clinicalfuture.com>
Tue, 17 Feb 2015 21:04:38 +0000 (21:04 +0000)
sdk/python/arvados/commands/arv_copy.py

index 7f5468eec686540b6facb04a5ee541dad1f76c25..57f79b804797a0e25f3c023fb91f6417213b15dd 100755 (executable)
@@ -412,7 +412,14 @@ def copy_collection(obj_uuid, src, dst, args):
             filters=[['portable_data_hash', '=', colhash]]
         ).execute()
         if dstcol['items_available'] > 0:
-            logger.debug("Skipping collection %s (already at dst)", obj_uuid)
+            if args.project_uuid:
+                c['owner_uuid'] = args.project_uuid
+                del c['uuid']
+                if 'properties' in c:
+                    del c['properties']
+                return dst.collections().create(body=c, ensure_unique_name=True).execute()
+            else:
+                logger.info("Skipping collection %s (already at dst)", obj_uuid)
             return dstcol['items'][0]
 
     # Fetch the collection's manifest.
@@ -467,8 +474,9 @@ def copy_collection(obj_uuid, src, dst, args):
     logger.debug('saving %s with manifest: <%s>', obj_uuid, dst_manifest)
     dst_keep.put(dst_manifest)
 
-    if 'uuid' in c:
-        del c['uuid']
+    del c['uuid']
+    if 'properties' in c:
+        del c['properties']
 
     if args.project_uuid:
         c['owner_uuid'] = args.project_uuid