executor: pf_api_service_restart_async
input:
  service: ""
  time_to_sleep: 0
  i_retry: 40
  i_delay: 3
  time_to_sleep_before_status: 0
steps:
- type: pf_api_service_action
  service: "{{.input.service}}"
  action: "restart"
  method: POST
  time_to_sleep: "{{.input.time_to_sleep}}"
  status_code: 202
  body: >-
    {
      "async": "true"
    }
  vars:
    task_id:
      from: result.pf_api_service_action_json.task_id

- type: pf_api_poll
  i_task_id: "{{.task_id}}"
  i_retry: "{{.input.i_retry}}"
  i_delay: "{{.input.i_delay}}"

- type: sleep
  time_to_sleep: "{{.input.time_to_sleep_before_status}}"

- type: pf_api_service_status
  service: "{{.input.service}}"
  retry: "{{.input.i_retry}}"
  delay: "{{.input.i_delay}}"
  assertions:
    - result.pf_api_service_status_json.alive ShouldEqual 1
