The value returned from this plugin is a bytes literal in Python 3 and a 
string literal in Python 2. For example, if there is a key "foo" with value 
"bar", Python 2 returns 'bar' (string) while Python 3 returns b'bar' (b' ' 
for bytes). 

This happens because the plugin uses the 
ansible.utils.cmd_functions.run_cmd function which simply returns the raw 
stdout. Python 2 ignores the byte encoding while Python 3 does not. This 
makes it necessary to manually handle the decoding of bytes (using 
bytes.decode() ) in Python 3 to make the value useful as a string because 
most use cases of this plugin would require string values. Is this the 
expected behavior?

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/29a237cb-3bf2-4eb5-b75f-9523ca15788fn%40googlegroups.com.

Reply via email to