Check for word boundaries around net interface name

Closes-Bug: #1617131
Change-Id: I9b962e2018173564eb0c35f88f16150944a08882
This commit is contained in:
Paulo Matias 2016-08-26 00:02:31 -03:00
parent a4b2802bdf
commit dcf4ba7de8

View File

@ -19,7 +19,7 @@ for container in $(lxc-ls); do
# If the link information is a veth and does not have a "master" continue # If the link information is a veth and does not have a "master" continue
if ! ip -o -d link show "${net_info}" | grep veth | grep -q master; then if ! ip -o -d link show "${net_info}" | grep veth | grep -q master; then
# Search for the interface file that contains the veth # Search for the interface file that contains the veth
lxc_interface_file=$(grep -l "${net_info}" /var/lib/lxc/${container}/{config,*.ini} | head -n 1) lxc_interface_file=$(grep -l "\b${net_info}\b" /var/lib/lxc/${container}/{config,*.ini} | head -n 1)
# If an interface file is found continue # If an interface file is found continue
if [ ! -z "${lxc_interface_file}" ];then if [ ! -z "${lxc_interface_file}" ];then
# Get the first network link line from the lxc configuration file # Get the first network link line from the lxc configuration file