17800: Fixes bug.
authorLucas Di Pentima <lucas.dipentima@curii.com>
Mon, 14 Jun 2021 14:01:36 +0000 (11:01 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Mon, 14 Jun 2021 14:01:36 +0000 (11:01 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>

sdk/python/arvados/commands/put.py

index 0920369646c6b7556babdef38fced98fee2e18b8..813c6ef2978d4af6ce0a658496a7142314c48f5a 100644 (file)
@@ -259,9 +259,8 @@ def parse_arguments(arguments):
 
     args.paths = ["-" if x == "/dev/stdin" else x for x in args.paths]
 
-    if len(args.paths) != 1 or os.path.isdir(args.paths[0]):
-        if args.filename:
-            arg_parser.error("""
+    if args.filename and (len(args.paths) != 1 or os.path.isdir(args.paths[0])):
+        arg_parser.error("""
     --filename argument cannot be used when storing a directory or
     multiple files.
     """)
@@ -525,6 +524,8 @@ class ArvPutUploadJob(object):
                 self._write_stdin(self.filename or 'stdin')
             elif not os.path.exists(path):
                  raise PathDoesNotExistError(u"file or directory '{}' does not exist.".format(path))
+            elif (not self.follow_links) and os.path.islink(path):
+                continue
             elif os.path.isdir(path):
                 # Use absolute paths on cache index so CWD doesn't interfere
                 # with the caching logic.