diff --git a/changelogs/fragments/92-fix-reference-in-content-template.yml b/changelogs/fragments/92-fix-reference-in-content-template.yml new file mode 100644 index 00000000..42401818 --- /dev/null +++ b/changelogs/fragments/92-fix-reference-in-content-template.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - content_template - Fix bad reference of library variable that was refactored to library_id diff --git a/plugins/modules/content_template.py b/plugins/modules/content_template.py index fd880c6c..2ed94d8c 100644 --- a/plugins/modules/content_template.py +++ b/plugins/modules/content_template.py @@ -181,7 +181,7 @@ def create_template_from_vm(self): ) def delete_template(self): - _template = self.get_library_item_ids(name=self.template, library_id=self.library) + _template = self.get_library_item_ids(name=self.template, library_id=self.library_id) if not _template: self.result['template_info'] = dict( msg="Template '%s' doesn't exists." % self.template, diff --git a/tests/integration/targets/vmware_content_template/tasks/main.yml b/tests/integration/targets/vmware_content_template/tasks/main.yml index e519ff0e..fafe8ede 100644 --- a/tests/integration/targets/vmware_content_template/tasks/main.yml +++ b/tests/integration/targets/vmware_content_template/tasks/main.yml @@ -60,6 +60,20 @@ - __res.template_info.msg == "Template '" + template_name + "'." when: not run_on_simulator + - name: Delete template from content library + vmware.vmware.content_template: + validate_certs: false + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + port: "{{ vcenter_port }}" + template: "{{ template_name }}" + library: "{{ library }}" + vm_name: "{{ vm }}" + host: "{{ template_host }}" + state: absent + when: not run_on_simulator + always: - name: "Test teardown: Destroy VM guest {{ vm }}" community.vmware.vmware_guest: