cloudinit.net refactor: apply_network_config_names#1388
Conversation
TheRealFalcon
left a comment
There was a problem hiding this comment.
@aciba90 , thanks for this contribution.
I think the end goal of the net refactor (which has admittedly stalled), is to remove methods from the distro classes entirely and into the networking classes. So the call in stages.py would be self.distro.networking.apply_network_config_names(netcfg) instead.
In order to do that, we would also need implementations in the BSD networking class. The current implementations (e.g., 1 2 3 ) are unsupported or no-ops and would also need to be refactored into this networking class setup.
|
Thank you for your comments.
I have removed those methods and made the change in
I have moved current implementations into @TheRealFalcon please let me know if there is something else to improve. |
TheRealFalcon
left a comment
There was a problem hiding this comment.
Thanks for addressing the requested changes. One more minor change in where the new networking class lives, and I think we'll be good here.
| LOG = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| class FreeBSDNetworking(BSDNetworking): |
There was a problem hiding this comment.
Let's put this class in networking.py. For now, I think it makes more sense there.
| ) | ||
|
|
||
|
|
||
| class TestLinuxNetworkingApplyNetworkCfgNames: |
There was a problem hiding this comment.
Nice refactor of these tests! This is much nicer.
| pytest.param("V2_CONFIG_NO_MAC", id="without_mac"), | ||
| ], | ||
| ) | ||
| def test_apply_v2_renames_skips_without_setname(self, config_attr: str): |
There was a problem hiding this comment.
Nit: test_apply_v2_renames_skips_without_setname_or_mac
288b377 to
ef17769
Compare
Thanks for the comments. Resolved! |
TheRealFalcon
left a comment
There was a problem hiding this comment.
LGTM, thanks! I'm going to briefly close and then reopen this PR to trigger a Travis rebuild.
| LOG = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| class FreeBSDNetworking(BSDNetworking): |
There was a problem hiding this comment.
Let's put this class into the networking.py. For now, I think it makes more sense there.
Proposed Commit Message
Checklist: