From cd957fae4cbee051c16e899c2d06a54e227c14fc Mon Sep 17 00:00:00 2001 From: Daniel Werner Date: Mon, 3 May 2021 07:25:08 +0200 Subject: [PATCH] Fix #2373 - TypeError: a bytes-like object is required, not 'str' (#2375) * Fix #2373 * Changelog fragment for #2373 * Update changelogs/fragments/2373-svr4pkg-fix-typeerror.yml Co-authored-by: Amin Vakil * Update changelogs/fragments/2373-svr4pkg-fix-typeerror.yml Co-authored-by: Felix Fontein Co-authored-by: Amin Vakil Co-authored-by: Felix Fontein --- changelogs/fragments/2373-svr4pkg-fix-typeerror.yml | 3 +++ plugins/modules/packaging/os/svr4pkg.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/2373-svr4pkg-fix-typeerror.yml diff --git a/changelogs/fragments/2373-svr4pkg-fix-typeerror.yml b/changelogs/fragments/2373-svr4pkg-fix-typeerror.yml new file mode 100644 index 0000000000..d0b3580889 --- /dev/null +++ b/changelogs/fragments/2373-svr4pkg-fix-typeerror.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - svr4pkg - convert string to a bytes-like object to avoid ``TypeError`` with Python 3 (https://github.com/ansible-collections/community.general/issues/2373). diff --git a/plugins/modules/packaging/os/svr4pkg.py b/plugins/modules/packaging/os/svr4pkg.py index ea3cd7d468..aa7a5c2e52 100644 --- a/plugins/modules/packaging/os/svr4pkg.py +++ b/plugins/modules/packaging/os/svr4pkg.py @@ -121,7 +121,7 @@ def package_installed(module, name, category): def create_admin_file(): (desc, filename) = tempfile.mkstemp(prefix='ansible_svr4pkg', text=True) - fullauto = ''' + fullauto = b''' mail= instance=unique partial=nocheck