]> git.proxmox.com Git - mirror_ifupdown2.git/commit
addons: address: catching and logging exception coming from `ip` batch execution
authorJulien Fortin <julien@cumulusnetworks.com>
Wed, 10 Aug 2016 13:08:38 +0000 (15:08 +0200)
committerJulien Fortin <julien@cumulusnetworks.com>
Thu, 11 Aug 2016 00:43:11 +0000 (02:43 +0200)
commit14593ccd63ab3c1ea137323d60d93c779fa0b98f
tree626b15ebc80e3e5014dc329646e0e5b7f5eded50
parent58329e8d89985e7c2c9375b5cd94ce29c1c87dd2
addons: address: catching and logging exception coming from `ip` batch execution

Ticket: CM-8610
Reviewed By: Roopa, Nikhil G
Testing Done:

It used to be a silent exception, but not anymore because we catch it and log
accordingly (error) and flag the ifaceobj so that ifupdown2 returns 1.

$ cat /etc/network/interfaces
auto tap0
iface tap0
      mtu 9000
            address 172.17.28.0/31

$ ifreload -a
$ echo "address 2002:17:27:17/120" >> /etc/network/interfaces
$ ifreload -a
$ echo $?
0
$ # applying this patch
$ ifreload -a
error: tap0: cmd 'ip -force -batch - [addr add 172.17.28.0/31 dev tap0
addr add 2002:17:27:17/120 dev tap0
]' failed: returned 1 (RTNETLINK answers: File exists
Command failed -:1
Error: an inet prefix is expected rather than "2002:17:27:17/120".
)
$ echo $?
1
$

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
addons/address.py