Skip to content

Commit 1a53c61

Browse files
committed
Fix ansible-core 2.19 compatibility
1 parent ce75a5a commit 1a53c61

File tree

6 files changed

+20
-13
lines changed

6 files changed

+20
-13
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
bugfixes:
2+
- vmware_guest_controller - Fix an issue with ansible-core 2.19
3+
(https://github.com/ansible-collections/community.vmware/pull/2391).

plugins/modules/vmware_guest_controller.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ def gather_disk_controller_facts(self):
345345
for device in self.current_vm_obj.config.hardware.device:
346346
ctl_facts_dict = dict()
347347
if isinstance(device, tuple(self.controller_types.values())):
348-
ctl_facts_dict[device.busNumber] = dict(
348+
ctl_facts_dict[str(device.busNumber)] = dict(
349349
controller_summary=device.deviceInfo.summary,
350350
controller_label=device.deviceInfo.label,
351351
controller_busnumber=device.busNumber,
@@ -355,7 +355,7 @@ def gather_disk_controller_facts(self):
355355
controller_disks_devicekey=device.device,
356356
)
357357
if hasattr(device, 'sharedBus'):
358-
ctl_facts_dict[device.busNumber]['controller_bus_sharing'] = device.sharedBus
358+
ctl_facts_dict[str(device.busNumber)]['controller_bus_sharing'] = device.sharedBus
359359
if isinstance(device, tuple(self.device_helper.scsi_device_type.values())):
360360
disk_ctl_facts['scsi'].update(ctl_facts_dict)
361361
if isinstance(device, self.device_helper.nvme_device_type):

tests/integration/targets/vmware_cluster_info/tasks/main.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
name: ensure info are gathered for all clusters
2020
assert:
2121
that:
22-
- all_cluster_result.clusters
22+
- all_cluster_result.clusters | length > 0
2323
- not all_cluster_result.changed
2424

2525
- name: ensure info are all defined
@@ -72,7 +72,7 @@
7272
name: Ensure info are gathered for the given cluster
7373
assert:
7474
that:
75-
- cluster_result.clusters
75+
- cluster_result.clusters | length > 0
7676
- not cluster_result.changed
7777

7878
- <<: *vc_cluster_data
@@ -99,7 +99,7 @@
9999
- name: Ensure info are gathered for all clusters with properteis
100100
assert:
101101
that:
102-
- all_cluster_result.clusters
102+
- all_cluster_result.clusters | length > 0
103103
- all_cluster_result.clusters[item].name == item
104104
- all_cluster_result.clusters[item].configuration.dasConfig.enabled is defined
105105
- all_cluster_result.clusters[item].summary.totalCpu is defined
@@ -123,7 +123,7 @@
123123
- name: Ensure info are gathered for the given cluster with properties
124124
assert:
125125
that:
126-
- cluster_result.clusters
126+
- cluster_result.clusters | length > 0
127127
- cluster_result.clusters[item].name == item
128128
- cluster_result.clusters[item].configuration.dasConfig.enabled is defined
129129
- cluster_result.clusters[item].summary.totalCpu is defined
@@ -191,4 +191,4 @@
191191
- name: "Ensure URL-encoded cluster name"
192192
assert:
193193
that:
194-
- all_cluster_result.clusters['Cluster/\%']
194+
- all_cluster_result.clusters['Cluster/\%'] is truthy

tests/integration/targets/vmware_datacenter_info/tasks/main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
- name: Ensure datacenter is present
2020
assert:
2121
that:
22-
- dc_result.datacenter_info
22+
- dc_result.datacenter_info | length > 0
2323

2424
- name: Gather information about all datacenter in check mode
2525
vmware_datacenter_info:
@@ -36,7 +36,7 @@
3636
- name: Ensure datacenter is present
3737
assert:
3838
that:
39-
- dc_result.datacenter_info
39+
- dc_result.datacenter_info | length > 0
4040

4141
- name: Gather information about particular datacenter
4242
vmware_datacenter_info:
@@ -53,7 +53,7 @@
5353
- name: Ensure datacenter is present
5454
assert:
5555
that:
56-
- dc_result.datacenter_info
56+
- dc_result.datacenter_info | length > 0
5757

5858
- name: Gather information about particular datacenter in check mode
5959
vmware_datacenter_info:
@@ -71,4 +71,4 @@
7171
- name: Ensure datacenter is present
7272
assert:
7373
that:
74-
- dc_result.datacenter_info
74+
- dc_result.datacenter_info | length > 0

tests/integration/targets/vmware_dvs_portgroup_info/tasks/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
assert:
6565
that:
6666
- >-
67-
dvs_results.dvs_portgroup_info.{{ dvswitch1 }}
67+
dvs_results.dvs_portgroup_info['{{ dvswitch1 }}']
6868
| map(attribute='portgroup_name')
6969
| select('==', 'dvportgroup\/%')
7070
| list
@@ -107,4 +107,4 @@
107107
- assert:
108108
that:
109109
- "dvs_results_0002['dvs_portgroup_info']['DVS0'] is defined"
110-
- dvs_results_0002['dvs_portgroup_info']['DVS0'][0].key
110+
- dvs_results_0002['dvs_portgroup_info']['DVS0'][0].key is truthy

tests/integration/targets/vmware_guest_boot_manager/tasks/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@
7575
that:
7676
- boot_info2.vm_boot_info.current_secure_boot_enabled is true
7777

78+
- name: Debug VMs
79+
debug:
80+
var: virtual_machines
81+
7882
- name: Get VM disk info 1
7983
community.vmware.vmware_guest_disk_info:
8084
validate_certs: false

0 commit comments

Comments
 (0)