From 8c7b302916438974e88b1fd24659199bd7b9c8f8 Mon Sep 17 00:00:00 2001 From: Mike Graves Date: Tue, 29 Jun 2021 08:41:33 -0400 Subject: [PATCH] Support template param in other collections (#154) * Support template param in other collections The action plugin for k8s does a collection name check for the template param, but it's missing redhat.openshift and community.kubernetes. * Add changelog fragment * Fix test --- changelogs/fragments/154-template-param-support.yaml | 3 +++ molecule/default/tasks/template.yml | 2 +- plugins/action/k8s_info.py | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/154-template-param-support.yaml diff --git a/changelogs/fragments/154-template-param-support.yaml b/changelogs/fragments/154-template-param-support.yaml new file mode 100644 index 00000000..e77342c3 --- /dev/null +++ b/changelogs/fragments/154-template-param-support.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - support the ``template`` param in all collections depending on kubernetes.core (https://github.com/ansible-collections/kubernetes.core/pull/154). diff --git a/molecule/default/tasks/template.yml b/molecule/default/tasks/template.yml index d7cba2dc..13246c37 100644 --- a/molecule/default/tasks/template.yml +++ b/molecule/default/tasks/template.yml @@ -22,7 +22,7 @@ assert: that: - r.failed - - "'is only supported parameter for' in r.msg" + - "'is only a supported parameter for' in r.msg" - name: Specify both definition and template kubernetes.core.k8s: diff --git a/plugins/action/k8s_info.py b/plugins/action/k8s_info.py index f36cdb12..e214825c 100644 --- a/plugins/action/k8s_info.py +++ b/plugins/action/k8s_info.py @@ -126,8 +126,8 @@ class ActionModule(ActionBase): def load_template(self, template, new_module_args, task_vars): # template is only supported by k8s module. - if self._task.action not in ('k8s', 'kubernetes.core.k8s', 'community.okd.k8s'): - raise AnsibleActionFail("'template' is only supported parameter for 'k8s' module.") + if self._task.action not in ('k8s', 'kubernetes.core.k8s', 'community.okd.k8s', 'redhat.openshift.k8s', 'community.kubernetes.k8s'): + raise AnsibleActionFail("'template' is only a supported parameter for the 'k8s' module.") template_params = [] if isinstance(template, string_types) or isinstance(template, dict):