Fix apply on Ansible 2.9 (#135)

* Fix apply on Ansible 2.9

For some reason the apply function can't be correctly imported in
Ansible 2.9. This just renames it to get it to import. I've also added
molecule testing on multiple Ansible versions.

* Add changelog fragment
This commit is contained in:
Mike Graves
2021-06-16 11:28:46 -04:00
committed by GitHub
parent 46494a18bd
commit c11a255026
19 changed files with 24 additions and 7 deletions

View File

@@ -19,7 +19,7 @@ __metaclass__ = type
from kubernetes.dynamic import DynamicClient
from ansible_collections.kubernetes.core.plugins.module_utils.apply import apply
from ansible_collections.kubernetes.core.plugins.module_utils.apply import k8s_apply
from ansible_collections.kubernetes.core.plugins.module_utils.exceptions import ApplyException
@@ -33,7 +33,7 @@ class K8SDynamicClient(DynamicClient):
if resource.namespaced:
body['metadata']['namespace'] = super().ensure_namespace(resource, namespace, body)
try:
return apply(resource, body)
return k8s_apply(resource, body)
except ApplyException as e:
raise ValueError("Could not apply strategic merge to %s/%s: %s" %
(body['kind'], body['metadata']['name'], e))