|
|
@ -337,12 +337,15 @@ def main():
|
|
|
|
if params['exclude_hosts'] is not None and state != 'drained':
|
|
|
|
if params['exclude_hosts'] is not None and state != 'drained':
|
|
|
|
module.fail_json(msg="exclude_hosts should only be with state=drained")
|
|
|
|
module.fail_json(msg="exclude_hosts should only be with state=drained")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
start = datetime.datetime.now()
|
|
|
|
start = datetime.datetime.now()
|
|
|
|
|
|
|
|
|
|
|
|
if delay:
|
|
|
|
if delay:
|
|
|
|
time.sleep(delay)
|
|
|
|
time.sleep(delay)
|
|
|
|
|
|
|
|
|
|
|
|
if state in [ 'stopped', 'absent' ]:
|
|
|
|
if not port and not path and state != 'drained':
|
|
|
|
|
|
|
|
time.sleep(timeout)
|
|
|
|
|
|
|
|
elif state in [ 'stopped', 'absent' ]:
|
|
|
|
### first wait for the stop condition
|
|
|
|
### first wait for the stop condition
|
|
|
|
end = start + datetime.timedelta(seconds=timeout)
|
|
|
|
end = start + datetime.timedelta(seconds=timeout)
|
|
|
|
|
|
|
|
|
|
|
@ -365,6 +368,8 @@ def main():
|
|
|
|
time.sleep(1)
|
|
|
|
time.sleep(1)
|
|
|
|
except:
|
|
|
|
except:
|
|
|
|
break
|
|
|
|
break
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
time.sleep(1)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
elapsed = datetime.datetime.now() - start
|
|
|
|
elapsed = datetime.datetime.now() - start
|
|
|
|
if port:
|
|
|
|
if port:
|
|
|
@ -427,6 +432,8 @@ def main():
|
|
|
|
except:
|
|
|
|
except:
|
|
|
|
time.sleep(1)
|
|
|
|
time.sleep(1)
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
time.sleep(1)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
elapsed = datetime.datetime.now() - start
|
|
|
|
elapsed = datetime.datetime.now() - start
|
|
|
|
if port:
|
|
|
|
if port:
|
|
|
|