Avoid ifup run if noifupdown is turned on
Take into account the noifupdown option for all
cmd.run states with explicit ifup call as well.
Change-Id: Ibd3021da9bf8df7d2fae455384dfad65c5e46432
Closes-Bug: PROD-26462
(cherry picked from commit 84bc341118d2184144a7cb9370c3e1d9746e7765)
diff --git a/linux/network/dpdk.sls b/linux/network/dpdk.sls
index c400831..7c76803 100644
--- a/linux/network/dpdk.sls
+++ b/linux/network/dpdk.sls
@@ -176,6 +176,9 @@
dpdk_ovs_bridge_up_{{ interface_name }}:
cmd.run:
- name: ifup {{ interface_name }}
+ {%- if network.noifupdown|d(false) or interface.noifupdown|d(false) %}
+ - onlyif: /bin/false
+ {%- endif %}
- require:
- file: dpdk_ovs_bridge_{{ interface_name }}
diff --git a/linux/network/interface.sls b/linux/network/interface.sls
index fbbe871..73e4c09 100644
--- a/linux/network/interface.sls
+++ b/linux/network/interface.sls
@@ -136,7 +136,12 @@
ovs_bridge_up_{{ interface_name }}:
cmd.run:
- - name: ifup {{ interface_name }}
+ - name: ifup --ignore-errors {{ interface_name }}
+ {%- if network.noifupdown|d(false) or interface.noifupdown|d(false) %}
+ - onlyif: /bin/false
+ {%- else %}
+ - unless: grep -qFx up /sys/class/net/{{ interface_name }}/operstate
+ {%- endif %}
- require:
- file: ovs_bridge_{{ interface_name }}
- file: linux_interfaces_final_include
@@ -200,6 +205,9 @@
ovs_port_up_{{ interface_name }}:
cmd.run:
- name: ifup {{ interface_name }}
+ {%- if network.noifupdown|d(false) or interface.noifupdown|d(false) %}
+ - onlyif: /bin/false
+ {%- endif %}
- require:
- file: ovs_port_{{ interface_name }}
- openvswitch_bridge: ovs_bridge_{{ interface.bridge }}_present