]> 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>
Wed, 10 Aug 2016 13:08:38 +0000 (15:08 +0200)
commit093ffa0028d508611727c9ee201c8428decdc124
tree73da69207e115621754f42af06607e6cabccb3fe
parent9d3f53c6c94fa50fc6c77d107f93c6e084fb5b04
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