From d4e9b7575c882ec20af05938ce4ed34aabb5b4d3 Mon Sep 17 00:00:00 2001 From: Peter Oliver Date: Tue, 25 Aug 2020 20:21:51 +0100 Subject: [PATCH] pkg5: wrap 'to modify' package list (#789) * pkg5: wrap 'to modify' package list Moved from https://github.com/ansible/ansible/pull/56378 * Add changelog fragment. * Correct markup. * Update changelogs/fragments/789-pkg5-wrap-to-modify-package-list.yaml Co-authored-by: Felix Fontein Co-authored-by: Felix Fontein --- changelogs/fragments/789-pkg5-wrap-to-modify-package-list.yaml | 2 ++ plugins/modules/packaging/os/pkg5.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/789-pkg5-wrap-to-modify-package-list.yaml 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