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 <akasurde@redhat.com>
pull/39437/merge
Abhijeet Kasurde 6 years ago committed by GitHub
parent 019decd29a
commit 3f9e4b16fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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']

Loading…
Cancel
Save