Merge "Revert "Change the list of extensions to a dict""
This commit is contained in:
commit
b16399ff4b
@ -31,7 +31,7 @@ intended to be used before output fetching in a base job's post-playbook.
|
|||||||
.. zuul:rolevar:: extensions_to_txt
|
.. zuul:rolevar:: extensions_to_txt
|
||||||
:default: null
|
:default: null
|
||||||
|
|
||||||
A dict of file extensions to be replaced with .txt when staging.
|
A list of file extensions to be replaced with .txt when staging.
|
||||||
This can be useful to ensure that text files with an extension not
|
This can be useful to ensure that text files with an extension not
|
||||||
registered in the web server may be viewed via browser when uploaded
|
registered in the web server may be viewed via browser when uploaded
|
||||||
to a file server.
|
to a file server.
|
||||||
@ -43,9 +43,8 @@ intended to be used before output fetching in a base job's post-playbook.
|
|||||||
Example:
|
Example:
|
||||||
|
|
||||||
extensions_to_txt:
|
extensions_to_txt:
|
||||||
conf: True
|
- conf
|
||||||
log: True
|
- log
|
||||||
txt: False
|
|
||||||
|
|
||||||
zuul.conf --(staged as)--> zuul_conf.txt
|
zuul.conf --(staged as)--> zuul_conf.txt
|
||||||
|
|
||||||
|
@ -5,26 +5,9 @@
|
|||||||
register: sources
|
register: sources
|
||||||
no_log: true
|
no_log: true
|
||||||
|
|
||||||
- name: Build the replace regex when the input is a list
|
- name: Build the replace regex
|
||||||
set_fact:
|
set_fact:
|
||||||
extensions_regex: "{{ extensions_to_txt | join('|') | default('__do_not_replace__') }}"
|
extensions_regex: "{{ extensions_to_txt | join('|') | default('__do_not_replace__') }}"
|
||||||
when: extensions_to_txt | type_debug == 'list'
|
|
||||||
|
|
||||||
- name: Output a warning when input is a list
|
|
||||||
debug:
|
|
||||||
msg: "WARNING: extensions_to_txt is a list, values defined by parents will be overwritten"
|
|
||||||
when: extensions_to_txt | type_debug == 'list'
|
|
||||||
|
|
||||||
- name: Build a list when replace regex is a dict
|
|
||||||
set_fact:
|
|
||||||
extensions_regex: "{{ extensions_regex | default('___') }}|{{ item.key }}"
|
|
||||||
with_dict: extensions_to_txt
|
|
||||||
when:
|
|
||||||
- extensions_to_txt | type_debug == 'dict'
|
|
||||||
- item.value == True
|
|
||||||
# NOTE(andreaf) Even if this is only executed for type 'dict', with_dict is
|
|
||||||
# still invoked somehow and it's causing an error when the input is a list
|
|
||||||
ignore_errors: yes
|
|
||||||
|
|
||||||
- debug:
|
- debug:
|
||||||
var: extensions_regex
|
var: extensions_regex
|
||||||
|
Loading…
Reference in New Issue
Block a user