Skip to content

Commit

Permalink
[PR #6923/7020b27b backport][stable-6] cobbler inventory plugin: Conv…
Browse files Browse the repository at this point in the history
…ert unicode to str (#6952)

cobbler inventory plugin: Convert unicode to str (#6923)

* plugins/inventory/cobbler: Convert unicode to str

* plugins/inventory/cobbler: Use text_type instead

(cherry picked from commit 7020b27)

Co-authored-by: Algirdas <76789112+Algirdas-Z@users.noreply.github.com>
  • Loading branch information
patchback[bot] and Algirdas-Z authored Jul 16, 2023
1 parent a4e1bee commit b104c58
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/6923-cobbler-inventory_unicode.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- cobbler inventory plugin - convert Ansible unicode strings to native Python unicode strings before passing user/password to XMLRPC client (https://github.com/ansible-collections/community.general/pull/6923).
3 changes: 2 additions & 1 deletion plugins/inventory/cobbler.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
from ansible.module_utils.common.text.converters import to_text
from ansible.module_utils.six import iteritems
from ansible.plugins.inventory import BaseInventoryPlugin, Cacheable, to_safe_group_name
from ansible.module_utils.six import text_type

# xmlrpc
try:
Expand Down Expand Up @@ -128,7 +129,7 @@ def _get_connection(self):
self.connection = xmlrpc_client.Server(self.cobbler_url, allow_none=True)
self.token = None
if self.get_option('user') is not None:
self.token = self.connection.login(self.get_option('user'), self.get_option('password'))
self.token = self.connection.login(text_type(self.get_option('user')), text_type(self.get_option('password')))
return self.connection

def _init_cache(self):
Expand Down

0 comments on commit b104c58

Please sign in to comment.