mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-16 05:59:47 -07:00
Use to_bytes on open and to_native on load_source.
This commit is contained in:
parent
a8e6577403
commit
53a640f2cc
1 changed files with 3 additions and 3 deletions
|
@ -18,7 +18,7 @@ from collections import defaultdict
|
||||||
|
|
||||||
from ansible import constants as C
|
from ansible import constants as C
|
||||||
from ansible.errors import AnsibleError
|
from ansible.errors import AnsibleError
|
||||||
from ansible.module_utils._text import to_bytes, to_text
|
from ansible.module_utils._text import to_bytes, to_native, to_text
|
||||||
from ansible.parsing.utils.yaml import from_yaml
|
from ansible.parsing.utils.yaml import from_yaml
|
||||||
from ansible.plugins import get_plugin_class, MODULE_CACHE, PATH_CACHE, PLUGIN_PATH_CACHE
|
from ansible.plugins import get_plugin_class, MODULE_CACHE, PATH_CACHE, PLUGIN_PATH_CACHE
|
||||||
from ansible.utils.display import Display
|
from ansible.utils.display import Display
|
||||||
|
@ -350,8 +350,8 @@ class PluginLoader:
|
||||||
|
|
||||||
with warnings.catch_warnings():
|
with warnings.catch_warnings():
|
||||||
warnings.simplefilter("ignore", RuntimeWarning)
|
warnings.simplefilter("ignore", RuntimeWarning)
|
||||||
with open(path, 'rb') as module_file:
|
with open(to_bytes(path), 'rb') as module_file:
|
||||||
module = imp.load_source(full_name, to_bytes(path), module_file)
|
module = imp.load_source(full_name, to_native(path), module_file)
|
||||||
return module
|
return module
|
||||||
|
|
||||||
def _update_object(self, obj, name, path):
|
def _update_object(self, obj, name, path):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue