Merge ~smoser/cloud-init:feature/net-convert-work-with-old into cloud-init:master

Proposed by Scott Moser on 2017-06-01
Status: Merged
Merged at revision: 79236a629f1e0e61b260d0cb995b6299a5c7aac1
Proposed branch: ~smoser/cloud-init:feature/net-convert-work-with-old
Merge into: cloud-init:master
Diff against target: 13 lines (+1/-1)
1 file modified
tools/net-convert.py (+1/-1)
Reviewer Review Type Date Requested Status
Ryan Harper 2017-06-01 Approve on 2017-06-01
Chad Smith Approve on 2017-06-01
Review via email: mp+324948@code.launchpad.net

Commit Message

tools/net-convert.py: support old cloudinit versions by using kwargs.

Older cloud-init versions have a bug in the signature of the
render_network_state method for netplan (bug 1685944).
The old had:
  render_network_state(target, network_state)
The correct is
  render_network_state(network_state, target)

This just changes our caller to use kwargs style when invoking that
method so that it works with either format.

To post a comment you must log in.
Scott Moser (smoser) wrote :

I found this when wanting to use the trunk's tools/net-convert.py against a dpkg installed version of cloud-init on xenial.

Chad Smith (chad.smith) wrote :

+1 on explicit kwargs for extensibility of the call for future revs as well as handling the existing param re-ordering difference.

review: Approve
Ryan Harper (raharper) wrote :

OK, I had to test it myself, but I'm convinced that specifying the name of parameters in kwarg style does indeed do the right thing here.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/tools/net-convert.py b/tools/net-convert.py
2index b2db8ad..68559cb 100755
3--- a/tools/net-convert.py
4+++ b/tools/net-convert.py
5@@ -75,7 +75,7 @@ def main():
6 r_cls = sysconfig.Renderer
7
8 r = r_cls()
9- r.render_network_state(ns, target=args.directory)
10+ r.render_network_state(network_state=ns, target=args.directory)
11
12
13 if __name__ == '__main__':

Subscribers

People subscribed via source and target branches

to all changes: