Merge "Make validate-host read from site-variables"

This commit is contained in:
Zuul 2017-09-08 22:57:45 +00:00 committed by Gerrit Code Review
commit 579d9f2202
8 changed files with 70 additions and 15 deletions

View File

@ -3,6 +3,7 @@ An ansible role to configure services to use mirrors.
**Role Variables**
.. zuul:rolevar:: mirror_fqdn
:default: {{ zuul_site_mirror_fqdn }}
The base host for mirror servers.

View File

@ -1,2 +1,3 @@
mirror_fqdn: "{{ zuul_site_mirror_fqdn|default(omit) }}"
pypi_mirror: "http://{{ mirror_fqdn }}/pypi/simple"
wheel_mirror: "http://{{ mirror_fqdn }}/wheel/{{ ansible_distribution | lower }}-{{ ansible_distribution_version }}-{{ ansible_architecture | lower }}"

View File

@ -1 +1,32 @@
Log information about the remote build host
Log information about the build node
**Role Variables**
.. zuul:rolevar:: zuul_traceroute_host
:default: {{ zuul_site_traceroute_host }}
If defined, a host to run a traceroute against to verify build node
network connectivity.
**DEPRECATED** being replaced by zuul_site versions.
.. zuul:rolevar:: zuul_image_manifest
:default: {{ zuul_site_image_manifest|default('/etc/dib-builddate.txt') }}
A file expected to be on the filesystem of the build node to read if it
exists and log. The default value comes from a site-variable called
``zuul_site_image_manifest``, but if that is not set
``/etc/dib-builddate.txt`` is used, which is written to nodes by
diskimage-builder in the ``nodepool-base`` element.
**DEPRECATED** being replaced by zuul_site versions.
.. zuul:rolevar:: zuul_site_traceroute_host
If defined, a host to run a traceroute against to verify build node
network connectivity.
.. zuul:rolevar:: zuul_site_image_manifest_files
:default: ['/etc/dib-builddate.txt', '/etc/image-hostname.txt']
A list of files to read from the filesystem of the build node and
whose contents will be logged. The default files are files written
to nodes by diskimage-builder.

View File

@ -0,0 +1,3 @@
zuul_site_traceroute_host: "{{ zuul_traceroute_host|default(omit) }}"
zuul_site_image_manifest: "{{ validate_host_default_image_manifest_files }}"
zuul_site_image_manifest_files: "{{ zuul_site_image_manifest_files|default(validate_host_default_image_manifest_files) }}"

View File

@ -42,16 +42,26 @@ def main():
module = AnsibleModule(
argument_spec=dict(
image_manifest=dict(required=False, type='str'),
image_manifest_files=dict(required=False, type='list'),
traceroute_host=dict(required=False, type='str'),
)
)
image_manifest = module.params['image_manifest']
traceroute_host = module.params['traceroute_host']
ret = {'image_manifest': None, 'traceroute': None}
image_manifest_files = module.params['image_manifest_files']
if not image_manifest_files and image_manifest:
image_manifest_files = [image_manifest]
ret = {'image_manifest_files': [], 'traceroute': None}
if image_manifest and os.path.exists(image_manifest):
ret['image_manifest'] = open(image_manifest, 'r').read()
for image_manifest in image_manifest_files:
if image_manifest and os.path.exists(image_manifest):
ret['image_manifest_files'].append({
'filename': image_manifest,
# Do this in python cause it's easier than in jinja2
'underline': len(image_manifest) * '-',
'content': open(image_manifest, 'r').read(),
})
if traceroute_host:
passed = False
try:

View File

@ -21,8 +21,9 @@
- name: Collect information about zuul worker
zuul_debug_info:
image_manifest: "{{ zuul_image_manifest|default(omit) }}"
traceroute_host: "{{ zuul_traceroute_host|default(omit) }}"
image_manifest: "{{ zuul_site_image_manifest|default(omit) }}"
image_manifest_files: "{{ zuul_site_image_manifest_files|default(omit) }}"
traceroute_host: "{{ zuul_site_traceroute_host|default(omit) }}"
register: zdi
- name: Write out all zuul information for each host

View File

@ -1,46 +1,51 @@
{% if 'image_manifest' in zdi %}
{% if zdi.image_manifest_files %}
Image Information
=================
{{ zdi.image_manifest }}
{% endif %}
{% for item in zdi.image_manifest_files %}
{{ item.filename }}
{{ item.underline }}
{{ item.content }}
{% endfor %}
{% endif %}
{% if 'uname' in zdi %}
Host & kernel
=============
{{ zdi.uname }}
{% endif %}
{% endif %}
{% if 'network_interfaces' in zdi %}
Network interface addresses
===========================
{{ zdi.network_interfaces }}
{% endif %}
{% endif %}
{% if 'network_routing_v4' in zdi %}
Network routing tables v4
=========================
{{ zdi.network_routing_v4 }}
{% endif %}
{% endif %}
{% if 'network_routing_v6' in zdi %}
Network routing tables v6
=========================
{{ zdi.network_routing_v6 }}
{% endif %}
{% endif %}
{% if 'network_neighbors' in zdi %}
Network neighbors
=================
{{ zdi.network_neighbors }}
{% endif %}
{% endif %}
{% if 'traceroute_v4' in zdi %}
Route to Known Host v4
======================
Known Host: {{ zuul_traceroute_host }}
{{ zdi.traceroute_v4 }}
{% endif %}
{% endif %}
{% if 'traceroute_v6' in zdi %}
Route to Known Host v6
======================

View File

@ -0,0 +1,3 @@
validate_host_default_image_manifest_files:
- /etc/dib-builddate.txt
- /etc/image-hostname.txt