From 79616f47cbd66134890b3f34f363f23e047ef298 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Thu, 17 Sep 2020 19:29:44 +0200 Subject: [PATCH] pkg5: wrap 'to modify' package list (#789) (#911) * 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 (cherry picked from commit d4e9b7575c882ec20af05938ce4ed34aabb5b4d3) Co-authored-by: Peter Oliver --- 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