Simplify network sanity checks
Simplify the network sanity check using the new /etc/ci/mirror_info.sh script. If thats present we use it to check pings to the mirror host and HTTP against the pypi mirror. If it isn't present we don't bother. Note this makes the sanity check fail the job again if it doesn't work which should be fine at this point because /etc/ci/mirror_info.sh should only exist if you have a mirror to provide information about. Change-Id: Ifddb7c5b7ae3e446005338c9679dd5441bc57062
This commit is contained in:
parent
2f3218e486
commit
ce56c6704e
|
@ -3,4 +3,4 @@ BASE: "{{ lookup('env', 'BASE')|default('/opt/stack', true) }}"
|
|||
CI_USER: "{{ lookup('env', 'CI_USER')|default(ansible_user_id, true) }}"
|
||||
PING_TIMES: 20
|
||||
HTTP_TIMES: 10
|
||||
PIP_CONFIG_FILE: "{{ lookup('env', 'PIP_CONFIG_FILE')|default('/etc/pip.conf', true) }}"
|
||||
MIRROR_INFO_FILE: "{{ lookup('env', 'MIRROR_INFO_FILE')|default('/etc/ci/mirror_info.sh', true) }}"
|
||||
|
|
|
@ -1,31 +1,20 @@
|
|||
---
|
||||
- name: Get status of file PIP_CONFIG_FILE
|
||||
stat: path={{ PIP_CONFIG_FILE }}
|
||||
- name: Get status of file MIRROR_INFO_FILE
|
||||
stat: path={{ MIRROR_INFO_FILE }}
|
||||
register: st
|
||||
- block:
|
||||
- name: Set pypi_url variable
|
||||
set_fact: pypi_url={{ lookup('ini', 'index-url section=global file=' + PIP_CONFIG_FILE) }}
|
||||
- name: Set pypi_host variable
|
||||
set_fact: pypi_host={{ pypi_url.split('/')[2].split(':')[0] }}
|
||||
- include: ping_check.yaml host={{ pypi_host }}
|
||||
- include: http_check.yaml url={{ pypi_url }}
|
||||
# Get the shell parsed values so that we are consistent with what is used
|
||||
# and don't have to do our own parsing.
|
||||
- name: Get NODEPOOL_MIRROR_HOST
|
||||
shell: source {{ MIRROR_INFO_FILE }} && echo $NODEPOOL_MIRROR_HOST
|
||||
register: mirror_host
|
||||
args:
|
||||
executable: /bin/bash
|
||||
- name: Get NODEPOOL_PYPI_MIRROR
|
||||
shell: source {{ MIRROR_INFO_FILE }} && echo $NODEPOOL_PYPI_MIRROR
|
||||
register: pypi_mirror
|
||||
args:
|
||||
executable: /bin/bash
|
||||
- include: ping_check.yaml host={{ mirror_host.stdout }}
|
||||
- include: http_check.yaml url={{ pypi_mirror.stdout }}
|
||||
when: st.stat.exists
|
||||
- name: Get NODEPOOL_MIRROR_HOST from /etc/nodepool/provider
|
||||
shell: grep NODEPOOL_MIRROR_HOST /etc/nodepool/provider | cut -d "=" -f2
|
||||
register: grep_mirror_host
|
||||
changed_when: False
|
||||
- name: Get NODEPOOL_REGION from /etc/nodepool/provider
|
||||
shell: grep NODEPOOL_REGION /etc/nodepool/provider | cut -d "=" -f2
|
||||
register: grep_region
|
||||
changed_when: False
|
||||
- name: Get NODEPOOL_CLOUD from /etc/nodepool/provider
|
||||
shell: grep NODEPOOL_CLOUD /etc/nodepool/provider | cut -d "=" -f2
|
||||
register: grep_cloud
|
||||
changed_when: False
|
||||
- name: Build NODEPOOL_MIRROR_HOST variable with region and cloud if undefined
|
||||
set_fact: NODEPOOL_MIRROR_HOST={{ grep_mirror_host.stdout|default("mirror." + grep_region.stdout|lower + "." + grep_cloud.stdout + ".openstack.org", true) }}
|
||||
- include: ping_check.yaml host={{ NODEPOOL_MIRROR_HOST }}
|
||||
ignore_errors: yes
|
||||
|
||||
- include: http_check.yaml url=http://{{ NODEPOOL_MIRROR_HOST }}/ubuntu/dists/trusty/Release
|
||||
ignore_errors: yes
|
||||
|
|
Loading…
Reference in New Issue