or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing
xxxxxxxxxx
Refactoring cloudinit/net
Background
About a year ago i got involved with cloud-init to add better FreeBSD support.
This culuminated in https://code.launchpad.net/~i.galic/cloud-init/+git/cloud-init/+merge/358228
I'd like to come back to this, and more imporantly, I'd like to get some help before I get started with it.
@Goneri's Pull Request to introduce a FreeBSD renderer is also a big inspiration.
I'm currently testing this patch, but it seems to be "write-only" so far.
Our primary goal in the refactoring then will be to open up cloudinit/net to be extensible in different Distros:
Currently
cloudinit/net
is almost entirely Linux specific. This has lead Goneri to introduce some rather unfortunate constructions:and
This only gets worse with the additions of NetBSD and OpenBSD
OOP?
In lp#358228 we tried to preserve the current API by moving the actual implementations into
cloudinit/net/linux.py
andcloudinit/net/freebsd.py
respectively and importing the correct implementationThis got tricky with functions that were already system independent and needed to be used in the system specific modules.
Perhaps it would be easier to pull this kind of design off with a class based aproach as we already use in Distro.
comments
from @Odd_Bloke:
Revisiting modules
In my previous attempt at refactoring
cloudinit.net
, i tried to move function by function to a new module, instead of moving it functionality.Perhaps a better aproach would be by checking which functions from cloudinit/net are actually used throughout the code, and declare those as the public interface.
Then we can move most of
cloudinit/net
intocloudinit/net/linux.py
, and only implement the public functions for FreeBSD.code duplication
vs
This class has a lot of that kind of duplication, and it would be wise to rethink it.
netinfo
The (public?) functions of this file do not seem to be used anywhere other than in:
… andgetgateway()
is never used.Ironically,
netdev_info()
is exactly what i'd like to create for FreeBSD'sifconfig
— because it provides so much info. All the info which on Linux we get from/sys/class/net/*/*