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>
This commit is contained in:
Abhijeet Kasurde 2018-04-28 20:27:53 +05:30 committed by GitHub
parent 019decd29a
commit 3f9e4b16fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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