Skip to content

Commit

Permalink
fix(libtofs): use select to deal with empty strings in path
Browse files Browse the repository at this point in the history
* To prevent path breakage when any of the following settings are used
  in the pillar/config:

```
  tofs:
    path_prefix: ''
    dirs:
      files:     ''
      default:   ''
```
  • Loading branch information
myii committed May 23, 2019
1 parent dca7888 commit afe0751
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions template/libtofs.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,13 @@
{%- else %}
{%- set fs_dir = salt['config.get'](tplroot ~ ':tofs:dirs:default', 'default') %}
{%- endif %}
{%- set url = '- salt://' ~ '/'.join([
{%- set url = [
'- salt:/',
path_prefix_inc_ext,
files_dir,
fs_dir,
src_file.lstrip('/')
]) %}
src_file,
] | select | join('/') %}
{{ url | indent(indent_width, true) }}
{%- endfor %}
{%- endfor %}
Expand Down

0 comments on commit afe0751

Please sign in to comment.