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

backport: Wait for host to be in result state (#621) #667

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- ovirt_host - Wait for host to be in result state during upgrade (https://github.com/oVirt/ovirt-ansible-collection/pull/667)
6 changes: 4 additions & 2 deletions plugins/modules/ovirt_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,10 +610,12 @@ def main():
)
# Set to False, because upgrade_check isn't 'changing' action:
hosts_module._changed = False

updates_available = host.update_available
ret = hosts_module.action(
action='upgrade',
action_condition=lambda h: h.update_available,
wait_condition=lambda h: not h.update_available or h.status == result_state and (
wait_condition=lambda h: h.status == result_state and ((
len([
event
for event in events_service.list(
Expand All @@ -625,7 +627,7 @@ def main():
search='type=842 or type=841 or type=888',
) if host.name in event.description
]) > 0
),
) or not updates_available),
post_action=lambda h: time.sleep(module.params['poll_interval']),
fail_condition=lambda h: hosts_module.failed_state_after_reinstall(h) or (
len([
Expand Down