From 3c20a9b12b054a455ec54988983005401fe04868 Mon Sep 17 00:00:00 2001 From: Ondra Machacek Date: Fri, 22 Mar 2019 09:56:49 +0100 Subject: [PATCH] kubevirt_template: Use proper api version (#54218) --- lib/ansible/modules/cloud/kubevirt/kubevirt_template.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/kubevirt/kubevirt_template.py b/lib/ansible/modules/cloud/kubevirt/kubevirt_template.py index d3af55b06a..7d45ff531f 100644 --- a/lib/ansible/modules/cloud/kubevirt/kubevirt_template.py +++ b/lib/ansible/modules/cloud/kubevirt/kubevirt_template.py @@ -272,6 +272,7 @@ class KubeVirtVMTemplate(KubeVirtRawModule): # Execute the CRUD of VM template: kind = 'Template' + template_api_version = 'template.openshift.io/v1' # Fill in template parameters: definition['parameters'] = self.params.get('parameters') @@ -337,7 +338,11 @@ class KubeVirtVMTemplate(KubeVirtRawModule): dummy, vm_def = self.construct_vm_template_definition('VirtualMachine', vm_definition, vm_template, obj) definition['objects'].append(vm_def) - result = self.execute_crud(kind, definition) + + # Create template: + resource = self.client.resources.get(api_version=template_api_version, kind=kind, name='templates') + definition = self.set_defaults(resource, definition) + result = self.perform_action(resource, definition) # Return from the module: self.exit_json(**{