Skip to content

Commit

Permalink
add subscribe library deletion to fix test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
shellymiron committed Dec 29, 2024
1 parent 7571e8e commit 07daff5
Showing 1 changed file with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,6 @@
library_id: "{{ ds_lib.id }}"
register: result

- name: print
ansible.builtin.debug:
msg: "{{ result }}"

- ansible.builtin.assert:
that:
- result.library_item_info | length == 0

- name: Create subscribed library
vmware.vmware_rest.content_subscribedlibrary:
name: sub_lib
Expand All @@ -285,7 +277,7 @@
on_demand: true
storage_backings:
- datastore_id: "{{ lookup('vmware.vmware_rest.datastore_moid', '/' + vcenter_datacenter + '/' + eco_nfs_datastore_iso) }}"
type: "DATASTORE"
type: 'DATASTORE'
register: sub_lib

- name: Create subscribed library (again)
Expand All @@ -298,7 +290,7 @@
on_demand: true
storage_backings:
- datastore_id: "{{ lookup('vmware.vmware_rest.datastore_moid', '/' + vcenter_datacenter + '/' + eco_nfs_datastore_iso) }}"
type: "DATASTORE"
type: 'DATASTORE'
register: result
- name: Assert the resource has not been changed
ansible.builtin.assert:
Expand Down Expand Up @@ -357,6 +349,11 @@
loop: "{{ content_libraries.value | selectattr('name', 'search', library_name) | list }}"
when: content_libraries.value is defined

- name: Delete subscribed library
vmware.vmware_rest.content_subscribedlibrary:
library_id: "{{ sub_lib.id }}"
state: absent

- name: Delete test VM
vmware.vmware_rest.vcenter_vm:
vm: "{{ lookup('vmware.vmware_rest.vm_moid', '/' + vcenter_datacenter + '/' + vcenter_cluster_name + '/' + vm_name) }}"
Expand Down

0 comments on commit 07daff5

Please sign in to comment.