mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-05-07 21:42:38 +00:00
[backport/2.2] Fix for common non-ASCII characters in CRDs (#334)
Co-authored-by: Alessandro Rossi <4215912+kubealex@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
bugfixes:
|
||||||
|
- module_utils.common - change default opening mode to read-bytes to avoid bad interpretation of non ascii characters and strings, often present in 3rd party manifests.
|
||||||
@@ -331,7 +331,7 @@ class K8sAnsibleMixin(object):
|
|||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
self.fail(msg="Error accessing {0}. Does the file exist?".format(path))
|
self.fail(msg="Error accessing {0}. Does the file exist?".format(path))
|
||||||
try:
|
try:
|
||||||
with open(path, 'r') as f:
|
with open(path, "rb") as f:
|
||||||
result = list(yaml.safe_load_all(f))
|
result = list(yaml.safe_load_all(f))
|
||||||
except (IOError, yaml.YAMLError) as exc:
|
except (IOError, yaml.YAMLError) as exc:
|
||||||
self.fail(msg="Error loading resource_definition: {0}".format(exc))
|
self.fail(msg="Error loading resource_definition: {0}".format(exc))
|
||||||
|
|||||||
Reference in New Issue
Block a user