openstack-ansible-lxc_conta.../templates/veth-cleanup.sh.j2
Logan V 789aaa4e73 Consistent configuration of veth_pair prefix
The veth_pair name was partially configurable, however eth0's
veth pair naming scheme was hard coded.

This change accomplishes:
- veth pair prefix templating is now consistent across all interfaces
  generated by the role.
- no change is made to the default configuration of veth pair naming,
  it only allows more reusability of the role by allowing the veth
  pair naming to be configured by the role's consumers.
- eth0 veth pair naming scheme can be configured just as other
  interfaces could be before.

Change-Id: I47004126cab85043f623aee8262151d3b53238e9
2017-04-23 20:48:25 -05:00

16 lines
662 B
Django/Jinja

#!/usr/bin/env bash
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# LXC eth0 is considered special and not managed by the base container_networks
# data structure. This is being added outside of the loop for this reason.
ip link del {{ lxc_container_network_veth_pair_prefix }}_eth0 || true
# Veth cleanup for items in the container_networks data structure
{% if container_networks is defined %}
{% for key, value in container_networks.items() %}
{% if value.type is not defined or value.type == 'veth' %}
ip link del {{ lxc_container_network_veth_pair_prefix }}_{{ value.interface }} || true
{% endif %}
{% endfor %}
{% endif %}