Ensure apk handles empty name strings properly (#10442)

* Ensure apk handles empty name strings

* Update changelog

* Update tests/integration/targets/apk/tasks/main.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update changelogs/fragments/10442-apk-fix-empty-names.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Remove redundant conditional

* Remove redundant ignore errors

* Reject apk with update cache for empty package names

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Giorgos Drosos 2025-07-27 12:52:07 +03:00 committed by GitHub
commit 3ad57ffa67
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 66 additions and 0 deletions

View file

@ -351,6 +351,9 @@ def main():
p = module.params
if all(not name.strip() for name in p['name']):
module.fail_json(msg="Package name(s) cannot be empty or whitespace-only")
if p['no_cache']:
APK_PATH = "%s --no-cache" % (APK_PATH, )