(compute_api, server)
| 199 | |
| 200 | |
| 201 | def wait_to_complete_state_transition(compute_api, server): |
| 202 | wait = compute_api.module.params["wait"] |
| 203 | if not wait: |
| 204 | return |
| 205 | wait_timeout = compute_api.module.params["wait_timeout"] |
| 206 | wait_sleep_time = compute_api.module.params["wait_sleep_time"] |
| 207 | |
| 208 | start = datetime.datetime.utcnow() |
| 209 | end = start + datetime.timedelta(seconds=wait_timeout) |
| 210 | while datetime.datetime.utcnow() < end: |
| 211 | compute_api.module.debug("We are going to wait for the server to finish its transition") |
| 212 | if fetch_state(compute_api, server) not in SCALEWAY_TRANSITIONS_STATES: |
| 213 | compute_api.module.debug("It seems that the server is not in transition anymore.") |
| 214 | compute_api.module.debug("Server in state: %s" % fetch_state(compute_api, server)) |
| 215 | break |
| 216 | time.sleep(wait_sleep_time) |
| 217 | else: |
| 218 | compute_api.module.fail_json(msg="Server takes too long to finish its transition") |
| 219 | |
| 220 | |
| 221 | def public_ip_payload(compute_api, public_ip): |
no test coverage detected