From 016035077ffbc7ad8e824ebdfb38f46eba057dde Mon Sep 17 00:00:00 2001 From: David Moreau-Simard Date: Sun, 20 Aug 2017 10:14:18 -0400 Subject: [PATCH] Add support for gzipping static ARA reports The ARA web application was designed to work properly when fully gzipped with the proper mimetypes so let's add support for doing that. Change-Id: Ic1914c840f5a75e7da07494fb87c2167ae7bed68 --- roles/emit-ara-html/README.rst | 15 ++++++++++++++- roles/emit-ara-html/defaults/main.yaml | 2 ++ roles/emit-ara-html/tasks/main.yaml | 11 ++++++++--- 3 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 roles/emit-ara-html/defaults/main.yaml diff --git a/roles/emit-ara-html/README.rst b/roles/emit-ara-html/README.rst index 75f667af7..389c63b06 100644 --- a/roles/emit-ara-html/README.rst +++ b/roles/emit-ara-html/README.rst @@ -1 +1,14 @@ -Have ara generate html logs if ara and ara data are both present. +Have ARA generate html logs if ARA and ARA data are both present. + +**Role Variables** + +.. zuul:rolevar:: ara_compress_html + + Whether to compress the ARA HTML output or not. + Defaults to ``true``. + +.. tip:: + Make sure the web server is configured to set the required mimetypes_ in + order to serve gzipped content properly. + +.. _mimetypes: https://git.openstack.org/cgit/openstack-infra/puppet-openstackci/tree/templates/logs.vhost.erb?id=5fe1f3d2d5e40c2458721e7dcf8631d62ea2525f#n24 diff --git a/roles/emit-ara-html/defaults/main.yaml b/roles/emit-ara-html/defaults/main.yaml new file mode 100644 index 000000000..29dedca2e --- /dev/null +++ b/roles/emit-ara-html/defaults/main.yaml @@ -0,0 +1,2 @@ +# Whether to compress the ARA HTML output or not +ara_compress_html: true diff --git a/roles/emit-ara-html/tasks/main.yaml b/roles/emit-ara-html/tasks/main.yaml index eca3f7267..58ec43cd6 100644 --- a/roles/emit-ara-html/tasks/main.yaml +++ b/roles/emit-ara-html/tasks/main.yaml @@ -1,14 +1,19 @@ -- name: Check for ara db +- name: Check for ARA db stat: path: "{{ zuul.executor.work_root }}/.ara/ansible.sqlite" register: ara_db_stat -- name: Check for ara install +- name: Check for ARA install command: which ara ignore_errors: yes register: ara_command_type when: ara_db_stat.stat.exists -- name: Generate ara html output +- name: Generate ARA html output command: "ara generate html {{ zuul.executor.log_root }}/ara" when: ara_command_type|succeeded and not ara_command_type|skipped + +- name: Compress ARA html output + archive: + path: "{{ zuul.executor.log_root }}/ara" + when: ara_compress_html | bool