Fix type checks in arv-copy recursive collection copying.
authorBrett Smith <brett@curoverse.com>
Fri, 31 Jul 2015 14:26:42 +0000 (10:26 -0400)
committerBrett Smith <brett@curoverse.com>
Fri, 31 Jul 2015 14:26:42 +0000 (10:26 -0400)
This is necessary follow-up from
79564b0ac7d03327cc351bbd6df544ab1f776380.  API objects are now
OrderedDicts instead of dicts, so `type(obj) == dict` is never true,
and calling this function on an API object is a noop.

No issue #.  I found this after receiving a user report that arv-copy
did not copy dependent collections from a pipeline template.

sdk/python/arvados/commands/arv_copy.py

index b68b5dccf5f7facf4aefe2efe69247a2871af05f..c5749cce5e860c5ee251f8f3bfa5616befa2c7d4 100755 (executable)
@@ -329,9 +329,9 @@ def copy_collections(obj, src, dst, args):
         obj = arvados.util.portable_data_hash_pattern.sub(copy_collection_fn, obj)
         obj = arvados.util.collection_uuid_pattern.sub(copy_collection_fn, obj)
         return obj
-    elif type(obj) == dict:
+    elif isinstance(obj, dict):
         return {v: copy_collections(obj[v], src, dst, args) for v in obj}
-    elif type(obj) == list:
+    elif isinstance(obj, list):
         return [copy_collections(v, src, dst, args) for v in obj]
     return obj