cloud: ovirt: Fix upgraded state of the ovirt_hosts module (#25535)
This commit is contained in:
parent
a1ceb1c404
commit
603d52f8fe
1 changed files with 6 additions and 2 deletions
|
@ -178,6 +178,7 @@ host:
|
|||
returned: On success if host is found.
|
||||
'''
|
||||
|
||||
import time
|
||||
import traceback
|
||||
|
||||
try:
|
||||
|
@ -307,6 +308,7 @@ def control_state(host_module):
|
|||
condition=lambda host: host.status == hoststate.MAINTENANCE,
|
||||
fail_condition=failed_state,
|
||||
)
|
||||
return host
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -350,7 +352,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=(
|
||||
|
@ -374,10 +376,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':
|
||||
|
|
Loading…
Reference in a new issue