Make wakeonlan Network Config v2 setting actually work#626
Conversation
|
if you're feeling very generous, you could try to add this to the bsd renderer as well! |
Hi Mina. I'm unfamiliar with how any of the BSDs manage WoL so I didn't want to try that. Also tests/unittests/test_net.py doesn't appear to have any existing testcases for the BSDs and I didn't want to be the first person to try and add them to it. Whilst I don't currently use RHEL, Opensuse/SLES, or Ubuntu (Netplan) I had enough previously familiarity with them to add their support in addition to the /etc/network/interface support which I currently use on both Alpine and Debian. |
|
i could provide a patch against your branch for wake-on-lan, but, yeah, tests, especially good ones, are currently a rarity |
I'd prefer to get this PR merged and then you could raise a further PR for BSD-specific support. |
| dhcp4: true | ||
| wakeonlan: true | ||
| version: 2 | ||
| """).rstrip(' '), |
There was a problem hiding this comment.
dedent is weird sometimes.
I don't htink you should need the rstrip here, and think you might have added it in an attempt to combat misuse of dedent.
You really need the \ on line 1359. dedent will remove the same number of spaces from the beginning of each line. but in this stanza, you your first line has no indentation (it is just "\n"). Add the \ and I think you can drop the rstrip.
There was a problem hiding this comment.
I'd copied (and modified) this testcase structure from "dhcpv6_stateless" and so that's inherited from it.
I'll test your suggestions and update accordingly.
There was a problem hiding this comment.
I've removed the rstrip.
However if I add the trailing \ to line 1359 the testcase fails - seems there needs to be a blank line before the "network:". There are other testcases in this file that are the same (I copied from one of them).
igalic
left a comment
There was a problem hiding this comment.
i don't have much to contribute here today…
e81679e to
54fd0d1
Compare
OddBloke
left a comment
There was a problem hiding this comment.
Thanks for the submission, Dermot! I really appreciate you taking the time to fix this across the multiple networking backends we support. 👍
I've identified a common issue, I think: if wakeonlan is specified as false, then the code still enables WOL (except for netplan, where it's just passed through). I may have got the wrong end of the stick on that, but either way, I think I'd like to see testing that setting it to false results in a standard network config being rendered.
(Aside from that, I have a comment on the sysconfig implementation specifically, inline.)
Thanks again!
54fd0d1 to
6c9de7d
Compare
|
@dermotbradley you should also do a rebase. |
Add code so that specifying "wakeonlan: true" actually results in relevant configuration entry appearing in /etc/network/interfaces, NetPlan, and sysconfig for RHEL and OpenSuse. Add testcases for the above.
6c9de7d to
1c208ab
Compare
|
All taken care of and rebased from master. |
OddBloke
left a comment
There was a problem hiding this comment.
Thanks for the updates!
Ensure if wakeonlan is specified in the network config that it is rendered in the /etc/network/interfaces or netplan config.
Ensure if wakeonlan is specified in the network config that it is rendered in the /etc/network/interfaces or netplan config.
Proposed Commit Message
Add code so that specifying "wakeonlan: true" actually results in relevant
configuration entry appearing in /etc/network/interfaces, NetPlan, and
sysconfig for RHEL and OpenSuse.
Add testcases for the above.
Additional Context
Test Steps
In a Network Config v2 YAML file specify the following:
Then check the resultant Netplan file to see if wakeonlan specified there.
Wakeonlan is not supported in a v1 config file.
Checklist: