vmware_host: ensure idempotency with state=absent (#54608)

If a host is already missing, `self.host_update` is `None`. With
this change,`state_exit_unchanged()` won't try anymore to access
`self.host_update.runtime`.
This commit is contained in:
Gonéri Le Bouder 2019-04-09 01:04:47 -04:00 committed by ansibot
parent 656ca13f65
commit bda0687d28

View file

@ -341,7 +341,9 @@ class VMwareHost(PyVmomi):
def state_exit_unchanged(self):
"""Exit with status message"""
if self.reconnect_disconnected and self.host_update.runtime.connectionState == 'disconnected':
if not self.host_update:
result = "Host already disconnected"
elif self.reconnect_disconnected and self.host_update.runtime.connectionState == 'disconnected':
self.state_reconnect_host()
else:
if self.folder_name: