Skip to content

Commit

Permalink
Merge pull request #146 from cityofships/route_options
Browse files Browse the repository at this point in the history
Fix regression in rendering RHEL route options
  • Loading branch information
markgoddard authored Jul 25, 2023
2 parents 9ed7492 + 52ea16f commit d808606
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
9 changes: 4 additions & 5 deletions templates/route6_RedHat.j2
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@
{% if 'table' in i %}
{% set route = route ~ ' table ' ~ i.table %}
{% endif %}
{{ route -}}
{% for option in i.options | default([]) %}
{% if option is mapping %}
{% set option = (option | dict2items | first).key %}
{% endif %}
{% set route = route ~ ' ' ~ option %}
{% if option is mapping %}{% set option = (option | dict2items | first).key %}{% endif %}
{{ option -}}
{% endfor %}
{{ route }}

{% endfor %}
{% endif %}
12 changes: 6 additions & 6 deletions templates/route_RedHat.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{% for i in item.route | default([]) %}
{# Workaround for Ansible bug https://github.com/ansible/ansible/issues/17872. #}
{% if i is mapping %} {# If route is not a mapping, then assume it's a complete rule #}
{% if i is mapping %}{# If route is not a mapping, then assume it's a complete rule #}
{% set prefix = ('0.0.0.0/' ~ i.netmask) | ipaddr('prefix') %}
{% set route = i.network ~ '/' ~ prefix %}
{% if 'gateway' in i %}
Expand All @@ -13,14 +13,14 @@
{% if 'table' in i %}
{% set route = route ~ ' table ' ~ i.table %}
{% endif %}
{{ route -}}
{% for option in i.options | default([]) %}
{% if option is mapping %}
{% set option = (option | dict2items | first).key %}
{% endif %}
{% set route = route ~ ' ' ~ option %}
{% if option is mapping %}{% set option = (option | dict2items | first).key %}{% endif %}
{{ option -}}
{% endfor %}

{% else %}
{% set route = i %}
{% endif %}
{{ route }}
{% endif %}
{% endfor %}

0 comments on commit d808606

Please sign in to comment.