From: Thanh Ha Date: Fri, 23 Nov 2018 01:50:48 +0000 (+0800) Subject: Skip archive copying when pattern is blank X-Git-Tag: v0.19.0~5 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=54dd4229000a3a7c44ecdcbe436ed8cac3698e20;p=releng%2Flftools.git Skip archive copying when pattern is blank 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 --- diff --git a/lftools/deploy.py b/lftools/deploy.py index 6f8128e8..e5b508de 100644 --- a/lftools/deploy.py +++ b/lftools/deploy.py @@ -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))