summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/conf_mode/container.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/conf_mode/container.py b/src/conf_mode/container.py
index 05595f86f..4b7ab3444 100755
--- a/src/conf_mode/container.py
+++ b/src/conf_mode/container.py
@@ -479,8 +479,13 @@ def apply(container):
# the network interface in advance
if 'network' in container:
for network, network_config in container['network'].items():
- tmp = Interface(f'podman-{network}')
- tmp.set_vrf(network_config.get('vrf', ''))
+ network_name = f'podman-{network}'
+ # T5147: Networks are started only as soon as there is a consumer.
+ # If only a network is created in the first place, no need to assign
+ # it to a VRF as there's no consumer, yet.
+ if os.path.exists(f'/sys/class/net/{network_name}'):
+ tmp = Interface(network_name)
+ tmp.set_vrf(network_config.get('vrf', ''))
return None