summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDag Wieers <dag@wieers.com>2016-09-21 20:34:05 +0200
committerRené Moser <mail@renemoser.net>2016-09-21 20:34:05 +0200
commitf96be15aa5135691f33e5fef6f176aafbaeb8fb6 (patch)
tree0320bc188bac453c2880f0bc541644e84255b2bd
parent258e6d60c87dd69cc11cb89f256813f864ba7986 (diff)
downloadansible-modules-core-f96be15aa5135691f33e5fef6f176aafbaeb8fb6.tar.gz
Backport #4626 to stable-2.1 (#4937)
This was requested in #4626
-rw-r--r--files/unarchive.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/files/unarchive.py b/files/unarchive.py
index 143246a6..a729bc0a 100644
--- a/files/unarchive.py
+++ b/files/unarchive.py
@@ -396,6 +396,7 @@ class ZipArchive(object):
elif stat.S_ISREG(st.st_mode) and timestamp < st.st_mtime:
# Add to excluded files, ignore other changes
out += 'File %s is newer, excluding file\n' % path
+ self.excludes.append(path)
continue
else:
if timestamp != st.st_mtime:
@@ -501,11 +502,11 @@ class ZipArchive(object):
cmd = '%s -o "%s"' % (self.cmd_path, self.src)
if self.opts:
cmd += ' ' + ' '.join(self.opts)
- if self.includes:
- cmd += ' "' + '" "'.join(self.includes) + '"'
- # We don't need to handle excluded files, since we simply do not include them
-# if self.excludes:
-# cmd += ' -x ' + ' '.join(self.excludes)
+ # NOTE: Including (changed) files as arguments is problematic (limits on command line/arguments)
+# if self.includes:
+# cmd += ' "' + '" "'.join(self.includes) + '"'
+ if self.excludes:
+ cmd += ' -x ' + ' '.join(self.excludes)
cmd += ' -d "%s"' % self.dest
rc, out, err = self.module.run_command(cmd)
return dict(cmd=cmd, rc=rc, out=out, err=err)