Merge branch 'master' into 2257-inequality-conditions
[arvados.git] / sdk / python / bin / arv-get
index fdbd12f959eb91e61d75adae338597bbe02c6319..30beedc2e762a7bf1cff35436adb5de01b3b4bda 100755 (executable)
@@ -124,7 +124,16 @@ if not get_prefix:
                 logger.error('Local file %s already exists' % args.destination)
                 sys.exit(1)
             with open(args.destination, 'wb') as f:
-                f.write(arvados.Keep.get(collection))
+                try:
+                    c = arvados.api('v1').collections().get(
+                        uuid=collection).execute()
+                    manifest = c['manifest_text']
+                except Exception as e:
+                    logging.warning(
+                        "API lookup failed for collection %s (%s: %s)" %
+                        (collection, type(e), str(e)))
+                    manifest = arvados.Keep.get(collection)
+                f.write(manifest)
         sys.exit(0)
     except arvados.errors.NotFoundError as e:
         logger.error(e)
@@ -145,7 +154,7 @@ try:
                 dest_path = os.path.join(
                     args.destination,
                     os.path.join(s.name(), f.name())[len(get_prefix)+1:])
-                if (not (args.f or args.skip_existing) and
+                if (not (args.n or args.f or args.skip_existing) and
                     os.path.exists(dest_path)):
                     logger.error('Local file %s already exists' % dest_path)
                     sys.exit(1)