← Back to team overview

cloud-init team mailing list archive

How to handle platform diferences in cloudinit.net module

 

moving from https://answers.launchpad.net/ubuntu/+source/cloud-init/+question/675536 as per smoser's suggestion

Currently, a lot of net/__init__.py is implemented exclusively for Linux systems which have the `ip` utility.

I'm trying to make this code run on FreeBSD, and short of adding `if`s all over the place, I'm a bit stuck on how exactly to handle this.

Does the call-hierarchy in cloud-init prefer methods / Classes (re)defined in a specific distro file?

scott said:

> As a first-pass answer, I think the goal woudl be really to get stuff into the cloudinit/net/ module that

> then had sane methodds that did the right thing. I do realize that freebsd did/does have lots of "if"s sprinkled throughout.

> I think we would like to better abstract / design this.



given similar uses in other parts of the code, i started with something like this:

https://git.launchpad.net/~i.galic/cloud-init/commit/?h=refactor/net-fbsd&id=65d8328a5a12b1a435d4386c0963774ea08c319e


o/~

i



Follow ups