Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vmware_host_config_manager: avoid failure if no change #55115

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def is_truthy(value):

def set_host_configuration_facts(self):
changed_list = []
changed = False
message = ''
for host in self.hosts:
option_manager = host.configManager.advancedOption
host_facts = {}
Expand Down Expand Up @@ -161,11 +161,10 @@ def set_host_configuration_facts(self):

if option_value != host_facts[option_key]['value']:
change_option_list.append(vim.option.OptionValue(key=option_key, value=option_value))
changed = True
changed_list.append(option_key)
else: # Don't silently drop unknown options. This prevents typos from falling through the cracks.
self.module.fail_json(msg="Unsupported option %s" % option_key)
if changed:
if changed_list:
if self.module.check_mode:
changed_suffix = ' would be changed.'
else:
Expand All @@ -189,7 +188,7 @@ def set_host_configuration_facts(self):
else:
message = 'All settings are already configured.'

self.module.exit_json(changed=changed, msg=message)
self.module.exit_json(changed=bool(changed_list), msg=message)


def main():
Expand Down