cloud-init network v2 config loses some settings when rendered

Bug #1685927 reported by Ryan Harper on 2017-04-24
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Medium
Unassigned
cloud-init (Ubuntu)
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) on 2018-10-10
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  Edit
Everyone can see this information.

Other bug subscribers