diff --git a/changelogs/fragments/789-pkg5-wrap-to-modify-package-list.yaml b/changelogs/fragments/789-pkg5-wrap-to-modify-package-list.yaml new file mode 100644 index 0000000000..8d766485e5 --- /dev/null +++ b/changelogs/fragments/789-pkg5-wrap-to-modify-package-list.yaml @@ -0,0 +1,2 @@ +bugfixes: + - "pkg5 - now works when Python 3 is used on the target (https://github.com/ansible-collections/community.general/pull/789)." diff --git a/plugins/modules/packaging/os/pkg5.py b/plugins/modules/packaging/os/pkg5.py index 02909bdf02..48c83150c3 100644 --- a/plugins/modules/packaging/os/pkg5.py +++ b/plugins/modules/packaging/os/pkg5.py @@ -148,7 +148,7 @@ def ensure(module, state, packages, params): else: no_refresh = ['--no-refresh'] - to_modify = filter(behaviour[state]['filter'], packages) + to_modify = list(filter(behaviour[state]['filter'], packages)) if to_modify: rc, out, err = module.run_command(['pkg', behaviour[state]['subcommand']] + dry_run + accept_licenses + beadm + no_refresh + ['-q', '--'] + to_modify) response['rc'] = rc