Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cloudinit/net/netplan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines +399 to +402
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this one-liner readable enough or is its behavior too convoluted?

Suggested change
if target is None:
target_ = target
else:
target_ = fpnplan
target_ = None if target is None else fpnplan

+1 either way I can see the integration tests succeeding with this PR.


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:
Expand Down