Fix cloud-init netconfig parsing - #136
Merged
Merged
Conversation
Member
|
Overall, LGTM. Thank you. Please allow me about a week, as I'm on vacation. |
metalefty
reviewed
Aug 19, 2026
|
|
||
| # nameservers & searchdomains | ||
| if [ -n "${_network_config_serachdomains}" -o -n "${_network_config_nameservers}" ]; then | ||
| if [ -n "${_network_config_searchdomains}" -o -n "${_network_config_nameservers}" ]; then |
Member
|
@mateuszkwiatkowski LGTM. Could you separate commits on |
The netconfig string passed to `vm create -C -n` was parsed with a bunch of `grep -oE 'key=[^;]*'` passes. This had several problems: - Unrecognised keys were silently ignored. Passing `gateway=` instead of `gateway4=`/`gateway6=` produced a guest with no default route and no warning of any kind. - Keys were matched as substrings, so `ip=` also matched inside any key ending in `ip`, and repeated occurrences were concatenated. Replace this with a loop that splits the string on `;` and matches each `key=value` pair, erroring out on an unknown key or on an entry with no `=`. Parsing now happens during argument validation, before the dataset and disks are created, so a bad netconfig string no longer leaves a half-created guest behind. While on that also fix two typos that made `searchdomains=` a complete no-op: the guard tested `_network_config_serachdomains` and the `search:` line read `_searchdomains`, neither of which is ever set. And declare `_ipv6_found` local rather than the unused `ipv6_found`.
`vm help create` listed the template option as `-f`; the option actually parsed by core::create is `-t`.
mateuszkwiatkowski
force-pushed
the
fix/netconfig-parsing
branch
2 times, most recently
from
August 19, 2026 13:40
548cc12 to
2580f47
Compare
Contributor
Author
I checked 1.7-stable and |
Contributor
Author
|
Ah, you probably meant backporting cloud-init fix. :-) Sorry! |
Member
Exactly! |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The netconfig string passed to
vm create -C -nwas parsed with a bunch ofgrep -oE 'key=[^;]*'passes. This had several problems:gateway=instead ofgateway4=/gateway6=produced a guest with no default route and no warning of any kind.ip=also matched inside any key ending inip, and repeated occurrences were concatenated.Replace this with a loop that splits the string on
;and matches eachkey=valuepair, erroring out on an unknown key or on an entry with no=.Parsing now happens during argument validation, before the dataset and disks are created, so a bad netconfig string no longer leaves a half-created guest behind.
While on that also fix two typos that made
searchdomains=a complete no-op: the guard tested_network_config_serachdomainsand thesearch:line read_searchdomains, neither of which is ever set. And declare_ipv6_foundlocal rather than the unusedipv6_found.Finally,
vm help createlisted the template option as-f; the option actually parsed by core::create is-t.