1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Rename 'archive' -> 'arcfile' in compress branch

This commit is contained in:
Ben Doherty 2016-06-01 08:29:14 -04:00 committed by Matt Clay
parent b0211c72d7
commit 42112060b5

View file

@ -315,16 +315,16 @@ def main():
changed = True changed = True
else: else:
size = 0 size = 0
f_in = f_out = archive = None f_in = f_out = arcfile = None
if os.path.lexists(dest): if os.path.lexists(dest):
size = os.path.getsize(dest) size = os.path.getsize(dest)
try: try:
if compression == 'zip': if compression == 'zip':
archive = zipfile.ZipFile(dest, 'w', zipfile.ZIP_DEFLATED) arcfile = zipfile.ZipFile(dest, 'w', zipfile.ZIP_DEFLATED)
archive.write(path, path[len(arcroot):]) arcfile.write(path, path[len(arcroot):])
archive.close() arcfile.close()
state = 'archive' # because all zip files are archives state = 'archive' # because all zip files are archives
else: else:
@ -346,8 +346,8 @@ def main():
module.fail_json(path=path, dest=dest, msg='Unable to write to compressed file: %s' % str(e)) module.fail_json(path=path, dest=dest, msg='Unable to write to compressed file: %s' % str(e))
if archive: if arcfile:
archive.close() arcfile.close()
if f_in: if f_in:
f_in.close() f_in.close()
if f_out: if f_out: