unarchive: fix io_buffer_size option, remove ignore.txt entry (#77271)

* Fix io_buffer_size option.

* Remove ignore.txt entry by adding action plugin only options to module's argument spec.

* Add changelog fragment.

* Adjust unit tests.
pull/77320/head
Felix Fontein 2 years ago committed by GitHub
parent c555ce1bd9
commit e3c72230cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- "unarchive - the ``io_buffer_size`` option added in 2.12 was not accepted by the module (https://github.com/ansible/ansible/pull/77271)."

@ -52,7 +52,7 @@ options:
description:
- Size of the volatile memory buffer that is used for extracting files from the archive in bytes.
type: int
default: 64 KiB
default: 65536
version_added: "2.12"
list_files:
description:
@ -304,7 +304,7 @@ class ZipArchive(object):
self.file_args = file_args
self.opts = module.params['extra_opts']
self.module = module
self.io_buffer_size = module.params.get("io_buffer_size", 64 * 1024)
self.io_buffer_size = module.params["io_buffer_size"]
self.excludes = module.params['exclude']
self.includes = []
self.include_files = self.module.params['include']
@ -976,6 +976,13 @@ def main():
include=dict(type='list', elements='str', default=[]),
extra_opts=dict(type='list', elements='str', default=[]),
validate_certs=dict(type='bool', default=True),
io_buffer_size=dict(type='int', default=64 * 1024),
# Options that are for the action plugin, but ignored by the module itself.
# We have them here so that the sanity tests pass without ignores, which
# reduces the likelihood of further bugs added.
copy=dict(type='bool', default=True),
decrypt=dict(type='bool', default=True),
),
add_file_common_args=True,
# check-mode only works for zip files, we cover that later

@ -94,7 +94,6 @@ lib/ansible/modules/stat.py validate-modules:undocumented-parameter
lib/ansible/modules/systemd.py validate-modules:parameter-invalid
lib/ansible/modules/systemd.py validate-modules:return-syntax-error
lib/ansible/modules/sysvinit.py validate-modules:return-syntax-error
lib/ansible/modules/unarchive.py validate-modules:nonexistent-parameter-documented
lib/ansible/modules/uri.py validate-modules:doc-required-mismatch
lib/ansible/modules/user.py validate-modules:doc-default-does-not-match-spec
lib/ansible/modules/user.py validate-modules:doc-default-incompatible-type

@ -52,6 +52,7 @@ class TestCaseZipArchive:
"extra_opts": "",
"exclude": "",
"include": "",
"io_buffer_size": 65536,
}
z = ZipArchive(
@ -74,6 +75,7 @@ class TestCaseTgzArchive:
"extra_opts": "",
"exclude": "",
"include": "",
"io_buffer_size": 65536,
}
fake_ansible_module.check_mode = False

Loading…
Cancel
Save