odl: Make odl_hostconfig patching idempotent
[fuel.git] / mcp / config / states / opendaylight
index eb6cc65..ae8b4cc 100755 (executable)
@@ -21,5 +21,7 @@ wait_for 5.0 "salt -I 'opendaylight:server' state.sls opendaylight"
 wait_for 20 "salt --out yaml -C 'I@neutron:server and *01*' network.connect $(odl bind_ip) $(odl rest_port) | fgrep -q 'result: true'"
 
 # https://bugs.launchpad.net/networking-odl/+bug/1822559
+FILE=/usr/lib/python3/dist-packages/networking_odl/cmd/set_ovs_hostconfigs.py
+PFILE=/var/tmp/odl_hostconfig.patch
 salt -I 'linux:network:bridge:openvswitch' pkg.install python3-networking-odl
-salt -I 'linux:network:bridge:openvswitch' file.patch /usr/lib/python3/dist-packages/networking_odl/cmd/set_ovs_hostconfigs.py /var/tmp/odl_hostconfig.patch || true
+salt -I 'linux:network:bridge:openvswitch' cmd.run "patch -R -s --dry-run $FILE < $PFILE || patch $FILE < $PFILE"