Skip to content

Commit

Permalink
ovirt_host: reinstalled - honor activate and reboot_after_installatio…
Browse files Browse the repository at this point in the history
…n when false (#587)

* ovirt_host: reinstalled - Allow to set activate and reboot_after_installation to false

* Add changelog
  • Loading branch information
mnecas authored Sep 2, 2022
1 parent 6311563 commit f3f3085
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- ovirt_host - Honor activate and reboot_after_installation when they are set to false with reinstalled host state (https://github.com/oVirt/ovirt-ansible-collection/pull/587).
16 changes: 9 additions & 7 deletions plugins/modules/ovirt_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,10 +719,11 @@ def main():
)

# Reinstall host:
hosts_module.action(
ret = hosts_module.action(
action='install',
action_condition=lambda h: h.status == hoststate.MAINTENANCE,
post_action=hosts_module.post_reinstall,
reboot=module.params.get('reboot_after_installation'),
wait_condition=lambda h: h.status == hoststate.MAINTENANCE,
fail_condition=hosts_module.failed_state_after_reinstall,
host=otypes.Host(
Expand All @@ -741,12 +742,13 @@ def main():
)

# Activate host after reinstall:
ret = hosts_module.action(
action='activate',
action_condition=lambda h: h.status == hoststate.MAINTENANCE,
wait_condition=lambda h: h.status == hoststate.UP,
fail_condition=failed_state,
)
if module.params['activate']:
ret = hosts_module.action(
action='activate',
action_condition=lambda h: h.status == hoststate.MAINTENANCE,
wait_condition=lambda h: h.status == hoststate.UP,
fail_condition=failed_state,
)
module.exit_json(**ret)
except Exception as e:
module.fail_json(msg=str(e), exception=traceback.format_exc())
Expand Down

0 comments on commit f3f3085

Please sign in to comment.