Bug fix: don't force rc=0 on first command 03/67303/3
authorManuel Buil <mbuil@suse.com>
Tue, 19 Mar 2019 15:10:53 +0000 (16:10 +0100)
committerManuel Buil <mbuil@suse.com>
Mon, 25 Mar 2019 13:33:09 +0000 (13:33 +0000)
When working with an interface that uses vlan, the vlan is created when
executing the ifup command. As we previously execute the command:

/sbin/ip addr flush dev {{ item }}

it will not return code 0 because the interface does not exist yet.
Consequently, the second part of the command (ifup) is never executed
and the new network config is never triggered.

This patch removes the requirement to get a rc=0 in the first command to
run the second one.

Note that /sbin/ip addr flush dev {{ item }} must be run before ifup
when working with non-vlan interfaces that already have an ip, otherwise
ifup fails in Ubuntu

Change-Id: Ieac273a49b78104f24d4c1ba81c263b450a40a9f
Signed-off-by: Manuel Buil <mbuil@suse.com>
xci/playbooks/roles/bootstrap-host/tasks/network_debian.yml

index 46f6e81..176c7eb 100644 (file)
@@ -90,7 +90,7 @@
     - "'opnfv' in inventory_hostname"
 
 - name: restart network service
-  shell: "/sbin/ip addr flush dev {{ item }} && /sbin/ifdown -a && /sbin/ifup -a"
+  shell: "/sbin/ip addr flush dev {{ item }}; /sbin/ifdown -a; /sbin/ifup -a"
   async: 15
   poll: 0
   with_items: