name: Restart services
testcases:
- name: restart_packetfence_config_service
  steps:
  - type: pf_api_system_service_restart_async
    service: 'packetfence-config'
    time_to_sleep: 5

- name: restart_pfqueue_service
  steps:
  - type: pf_api_service_restart_async
    service: "pfqueue-backend"
    time_to_sleep: 5

  - type: pf_api_service_restart_async
    service: "pfqueue-go"
    time_to_sleep: 5

- name: update_systemd
  steps:
  - type: http
    method: POST
    url: '{{.pfserver_webadmin_url}}/api/v1/configurator/service/pf/update_systemd'
    ignore_verify_ssl: true
    headers:
      "Content-Type": "application/json"
    assertions:
      - result.statuscode ShouldEqual 200
      - result.bodyjson.message ShouldEqual "Updated systemd for pf"

- name: restart_haproxy_admin_service
  steps:
  - type: pf_api_service_restart_async
    service: 'haproxy-admin'

# to apply changes made during custom step
# no API call usable
- name: restart_pfperl_api_service
  steps:
  - type: systemctl_service_restart
    service: 'packetfence-pfperl-api'
    time_to_sleep: 10

- name: start_pf_services
  steps:
  - type: pf_api_service_pf_start_async
