mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-03-26 21:33:02 +00:00
Fix for common non-ASCII characters in CRDs (#308)
Fix for common non-ASCII characters in CRDs This should keep the module safe from digesting non-ASCII chars like here (https://github.com/projectcalico/api/pull/46/files) SUMMARY Add support for non-ASCII chars in manifests. ISSUE TYPE Bugfix Pull Request COMPONENT NAME core.k8s module failing if resources contain non ascii chars Reviewed-by: Abhijeet Kasurde <None> Reviewed-by: Mike Graves <mgraves@redhat.com> Reviewed-by: Alessandro Rossi <None> Reviewed-by: None <None>
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.
|
||||
@@ -496,7 +496,7 @@ class K8sAnsibleMixin(object):
|
||||
if not os.path.exists(path):
|
||||
self.fail(msg="Error accessing {0}. Does the file exist?".format(path))
|
||||
try:
|
||||
with open(path, "r") as f:
|
||||
with open(path, "rb") as f:
|
||||
result = list(yaml.safe_load_all(f))
|
||||
except (IOError, yaml.YAMLError) as exc:
|
||||
self.fail(msg="Error loading resource_definition: {0}".format(exc))
|
||||
|
||||
Reference in New Issue
Block a user