stage-output: fix the archiving of all files
The archival task currently relies on the content of all_sources, but some files are renamed afterwards if their extensions match one of the special extension of the list. This means that few files from all_sources are not found and then not compressed. Change then the logic: simply discover all files inside logs and compress all of them. Change-Id: I7d34d7d90849736b7b842c0bdd67492816f98ebc
This commit is contained in:
parent
a5dbe86b4b
commit
d89f67aadf
@ -88,18 +88,25 @@
|
|||||||
tags:
|
tags:
|
||||||
- skip_ansible_lint
|
- skip_ansible_lint
|
||||||
|
|
||||||
|
- block:
|
||||||
|
- name: Discover log files for compression
|
||||||
|
find:
|
||||||
|
paths: "{{ stage_dir }}/logs"
|
||||||
|
recurse: true
|
||||||
|
file_type: 'file'
|
||||||
|
register: log_files_to_compress
|
||||||
|
|
||||||
# NOTE(andreaf) The ansible module does not support recursive archive, so
|
# NOTE(andreaf) The ansible module does not support recursive archive, so
|
||||||
# using gzip is the only option here. The good bit is that gzip itself is
|
# using gzip is the only option here. The good bit is that gzip itself is
|
||||||
# almost idempotent, as it will not compress again files with .gz extension.
|
# almost idempotent, as it will not compress again files with .gz extension.
|
||||||
# gzip will however return 1 if any compressed file is encountered, so we
|
# gzip will however return 1 if any compressed file is encountered, so we
|
||||||
# must ignore that (there's no specific error code).
|
# must ignore that (there's no specific error code).
|
||||||
- name: Archive everything from docs sources
|
- name: Archive everything from logs
|
||||||
shell: gzip --recursive --best {{ item.dest }} || true
|
shell: gzip --recursive --best {{ item.path }} || true
|
||||||
args:
|
args:
|
||||||
chdir: "{{ stage_dir }}"
|
chdir: "{{ stage_dir }}/logs"
|
||||||
with_items: "{{ all_sources }}"
|
with_items: "{{ log_files_to_compress.files }}"
|
||||||
when:
|
|
||||||
- stage_compress_logs
|
|
||||||
- item.type == 'logs'
|
|
||||||
tags:
|
tags:
|
||||||
- skip_ansible_lint
|
- skip_ansible_lint
|
||||||
|
when:
|
||||||
|
- stage_compress_logs
|
||||||
|
Loading…
Reference in New Issue
Block a user