From 3f9e4b16fed706407be695a72749fd9f0fe0fd27 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Sat, 28 Apr 2018 20:27:53 +0530 Subject: [PATCH] VMware: correct comparison for guest_id (#39291) This fix corrects the comparison of system generated guest_id with user provided guest_id. Module used to report change even if the guest_ids were same. For example, user provided guest id rhel7_64guest and VMware returned guest id rhel7_64Guest are logically same but lexicographically different and due to this module use to report change even if there is no change applied. Signed-off-by: Abhijeet Kasurde --- lib/ansible/modules/cloud/vmware/vmware_guest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/vmware/vmware_guest.py b/lib/ansible/modules/cloud/vmware/vmware_guest.py index ba78418b98..71c2cff2f3 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_guest.py +++ b/lib/ansible/modules/cloud/vmware/vmware_guest.py @@ -699,7 +699,8 @@ class PyVmomiHelper(PyVmomi): if vm_creation and self.params['guest_id'] is None: self.module.fail_json(msg="guest_id attribute is mandatory for VM creation") - if self.params['guest_id'] and (vm_obj is None or self.params['guest_id'] != vm_obj.summary.config.guestId): + if self.params['guest_id'] and \ + (vm_obj is None or self.params['guest_id'].lower() != vm_obj.summary.config.guestId.lower()): self.change_detected = True self.configspec.guestId = self.params['guest_id']