cloud-init network v2 config loses some settings when rendered

Bug #1685927 reported by Ryan Harper
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Triaged
Medium
Unassigned
cloud-init (Ubuntu)
Triaged
Medium
Unassigned

Bug Description

Running a v2 network-config through cloud-init's net-convert we can see that we're not passing it through, but importing and re-rendering lossy.

% cat simple-v2.yaml
network:
  version: 2
  # comment above ethernets
  ethernets:
      ens0:
         dhcp4: true
         match:
           macaddress: 00:11:22:33:44:55
         set-name: ens0
      switchports:
        # all cards on second PCI bus; unconfigured by themselves, will be added
        # to br0 below
        match:
          name: enp2*
        mtu: 1280

% PYTHONPATH=`pwd` ./tools/net-convert.py --network-data simple-v2.yaml --kind yaml --output-kind netplan -d target

% cat target/etc/netplan/50-cloud-init.yaml

network:
    version: 2
    ethernets:
        ens0:
            dhcp4: true
        switchports:
            mtu: 1280

We lose comments and matching.

Also note, ./tools/net-convert.py has a bug, the order of parameters to the rendering class changed.

% git diff tools/net-convert.py
diff --git a/tools/net-convert.py b/tools/net-convert.py
index 870da63..ec4ee64 100755
--- a/tools/net-convert.py
+++ b/tools/net-convert.py
@@ -75,7 +75,7 @@ def main():
         r_cls = sysconfig.Renderer

     r = r_cls()
- r.render_network_state(ns, target=args.directory)
+ r.render_network_state(args.directory, ns)

 if __name__ == '__main__':

Scott Moser (smoser)
Changed in cloud-init:
status: New → Confirmed
Changed in cloud-init (Ubuntu):
status: New → Confirmed
Changed in cloud-init:
importance: Undecided → Medium
Changed in cloud-init (Ubuntu):
importance: Undecided → Medium
Changed in cloud-init:
status: Confirmed → Triaged
Changed in cloud-init (Ubuntu):
status: Confirmed → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.