Skip to content

Commit

Permalink
Fix indentation, check if IP addresses are strings
Browse files Browse the repository at this point in the history
  • Loading branch information
jbemmel committed Dec 25, 2024
1 parent 72b00db commit a8aea7d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions netsim/ansible/templates/initial/linux/ubuntu.j2
Original file line number Diff line number Diff line change
Expand Up @@ -158,17 +158,17 @@ network:
transmit-hash-policy: encap3+4
{% else %}
{{ l.ifname }}:
{% if l.mtu is defined %}
{% if l.mtu is defined %}
mtu: {{ l.mtu }}
{% endif %}
{% endif %}
{% endif %}
{% if l.dhcp.client.ipv4|default(False) %}
dhcp4: true
{% endif %}
{% if l.dhcp.client.ipv6|default(False) %}
dhcp6: true
{% endif %}
{% for af in ('ipv4','ipv6') if af in l %}
{% for af in ('ipv4','ipv6') if af in l and l[af] is string %}
{% if loop.first %}
addresses:
{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions netsim/ansible/templates/initial/linux/vanilla.j2
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ ip -6 addr add {{ loopback.ipv6 }} dev lo
{{ create_bond_dev(l,node_provider) }}
{% endif %}
ip link set dev {{ l.ifname }} up
{% if l.ipv4 is defined %}
{% if l.ipv4 is defined and l.ipv4 is string %}
set +e
ip addr del {{ l.ipv4 }} dev {{ l.ifname }} 2>/dev/null
set -e
ip addr add {{ l.ipv4 }} dev {{ l.ifname }}
{% endif %}
{% if l.ipv6 is defined %}
{% if l.ipv6 is defined and l.ipv6 is string %}
sysctl -w net.ipv6.conf.{{ l.ifname }}.disable_ipv6=0
set +e
ip -6 addr del {{ l.ipv6 }} dev {{ l.ifname }} 2>/dev/null
Expand Down

0 comments on commit a8aea7d

Please sign in to comment.