Skip to content

Commit

Permalink
fix content_template library_id reference in delete
Browse files Browse the repository at this point in the history
  • Loading branch information
mikemorency committed Dec 19, 2024
1 parent bb1aba5 commit df18051
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelogs/fragments/92-fix-reference-in-content-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
minor_changes:
- content_template - Fix bad reference of library variable that was refactored to library_id
2 changes: 1 addition & 1 deletion plugins/modules/content_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 184 in plugins/modules/content_template.py

View check run for this annotation

Codecov / codecov/patch

plugins/modules/content_template.py#L184

Added line #L184 was not covered by tests
if not _template:
self.result['template_info'] = dict(
msg="Template '%s' doesn't exists." % self.template,
Expand Down
13 changes: 13 additions & 0 deletions tests/integration/targets/vmware_content_template/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@
host: "{{ template_host }}"
register: __res

- name: Delete template from vm in 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 }}"
host: "{{ template_host }}"
state: absent
register: __res

- name: Assert values
ansible.builtin.assert:
that:
Expand Down

0 comments on commit df18051

Please sign in to comment.