From 812a0e8b8fe8a59abad3e1bdb8f19da7b0b48810 Mon Sep 17 00:00:00 2001 From: Alberto Contreras Date: Thu, 11 Sep 2025 11:42:39 +0200 Subject: [PATCH] fix: correct netplan renderer target Only pass absolute path to netplan python API if an explicit target is passed to netplan.Renderer.render_network_state. That is, when called from cloud-init net-convert. --- cloudinit/net/netplan.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cloudinit/net/netplan.py b/cloudinit/net/netplan.py index cf874756428..98530d8422b 100644 --- a/cloudinit/net/netplan.py +++ b/cloudinit/net/netplan.py @@ -395,8 +395,14 @@ def render_network_state( header += "\n" content = header + content + # Customize target only if explicitly passed in + if target is None: + target_ = target + else: + target_ = fpnplan + netplan_config_changed = has_netplan_config_changed(fpnplan, content) - if not netplan_api_write_yaml_file(content, target=fpnplan): + if not netplan_api_write_yaml_file(content, target=target_): fallback_write_netplan_yaml(fpnplan, content) if self.clean_default: