Skip archive copying when pattern is blank 33/13633/1
authorThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 23 Nov 2018 01:50:48 +0000 (09:50 +0800)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 23 Nov 2018 01:50:51 +0000 (09:50 +0800)
Blank patterns are invalid patterns to be copying and causes lftools
to incorrectly copy the entire current working directory. This patch
detects that pattern and skips the pattern as a pattern to archive.

Issue: RELENG-1512
Change-Id: Ia7b0ae4a5b1d6996919bfc2a10deea4c9db84f17
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
lftools/deploy.py

index 6f8128e..e5b508d 100644 (file)
@@ -172,6 +172,9 @@ def copy_archives(workspace, pattern=None):
 
     paths = []
     for p in pattern:
+        if p == '':  # Skip empty patterns as they are invalid
+            continue
+
         search = os.path.join(workspace, p)
         paths.extend(glob2.glob(search, recursive=True))
     log.debug('Files found: {}'.format(paths))