diff --git a/changelogs/fragments/3909-nrdp_fix_string_args_without_encoding.yaml b/changelogs/fragments/3909-nrdp_fix_string_args_without_encoding.yaml new file mode 100644 index 0000000000..bc96830844 --- /dev/null +++ b/changelogs/fragments/3909-nrdp_fix_string_args_without_encoding.yaml @@ -0,0 +1,2 @@ +bugfixes: + - nrdp callback plugin - fix error ``string arguments without an encoding`` (https://github.com/ansible-collections/community.general/issues/3903). diff --git a/plugins/callback/nrdp.py b/plugins/callback/nrdp.py index 744c2d2ed4..08096cab72 100644 --- a/plugins/callback/nrdp.py +++ b/plugins/callback/nrdp.py @@ -70,6 +70,7 @@ import os import json from ansible.module_utils.six.moves.urllib.parse import urlencode +from ansible.module_utils.common.text.converters import to_bytes from ansible.module_utils.urls import open_url from ansible.plugins.callback import CallbackBase @@ -143,7 +144,7 @@ class CallbackModule(CallbackBase): body = { 'cmd': 'submitcheck', 'token': self.token, - 'XMLDATA': bytes(xmldata) + 'XMLDATA': to_bytes(xmldata) } try: