cloud: ovirt: Fix upgraded state of the ovirt_hosts module (#25169)

This commit is contained in:
Ondra Machacek 2017-06-08 22:58:54 +02:00 committed by Ryan Brown
parent c17efa4aaa
commit d7b3ace0b0

View file

@ -179,6 +179,7 @@ host:
type: dict
'''
import time
import traceback
try:
@ -309,6 +310,8 @@ def control_state(host_module):
fail_condition=failed_state,
)
return host
def main():
argument_spec = ovirt_full_argument_spec(
@ -351,7 +354,7 @@ def main():
)
state = module.params['state']
control_state(hosts_module)
host = control_state(hosts_module)
if state == 'present':
hosts_module.create(
deploy_hosted_engine=(
@ -375,10 +378,12 @@ def main():
)
ret = hosts_module.create()
elif state == 'upgraded':
result_state = hoststate.MAINTENANCE if host.status == hoststate.MAINTENANCE else hoststate.UP
ret = hosts_module.action(
action='upgrade',
action_condition=lambda h: h.update_available,
wait_condition=lambda h: h.status == hoststate.UP,
wait_condition=lambda h: h.status == result_state,
post_action=lambda h: time.sleep(module.params['poll_interval']),
fail_condition=failed_state,
)
elif state == 'started':