[patch] Drop obsolete OVS port with route support
[fuel.git] / mcp / salt-formulas / opnfv / route_wrapper.sls
1 ##############################################################################
2 # Copyright (c) 2018 Mirantis Inc., Enea AB and others.
3 # All rights reserved. This program and the accompanying materials
4 # are made available under the terms of the Apache License, Version 2.0
5 # which accompanies this distribution, and is available at
6 # http://www.apache.org/licenses/LICENSE-2.0
7 ##############################################################################
8 /usr/local/sbin/route:
9   file.managed:
10     - contents: |
11         #!/bin/sh
12
13         # Workaround salt-managed routes breaking ifup when route already exists
14         route_binary='/sbin/route'
15         route_output=$("${route_binary}" "$@" 2>&1)
16         route_return=$?
17
18         if [ -n "${route_output}" ]; then
19             if echo "${route_output}" | grep -q 'SIOCADDRT: File exists'; then
20                 exit 0
21             fi
22             echo "${route_output}"
23         fi
24         exit "${route_return}"
25     - user: root
26     - group: root
27     - mode: 755