Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

expected_status = 400 doesn't work #3

Open
kkorsakov opened this issue May 19, 2015 · 1 comment
Open

expected_status = 400 doesn't work #3

kkorsakov opened this issue May 19, 2015 · 1 comment

Comments

@kkorsakov
Copy link

Module throws error when response status is 400.

- name: Wait for service to be up
  health_check: expected_status=400 url=http://127.0.0.1:8090/pushreport

Error:

TASK: [roox-stat-fe | Wait for service to be up] ******************************
failed: [mks] => {"failed": true, "failed_attempts": 9}
msg: Maximum attempts reached: HTTP Error 400:
@randm-ch
Copy link

randm-ch commented Jun 8, 2018

I had the same problem with status 500:

- name: Wait for website to become available
  health_check:
    url: "{{ base_url }}"
    initial_delay: 5
    delay_between_tries: 5
    max_retries: 20
    expected_status: 500
    expected_regexp: "Cannot find error page with key: _internalError"

Fixed it by changing except (URLError, HTTPException, socket.error) as e: (health_check on line 101) to except URLError as e:. I ported the script to Python 3 and it works for me, but I'm not sure if it would be applicable for Python 2 as well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants