-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
YAML consolidation: netplan get
(FR-702)
#252
Conversation
Codecov Report
@@ Coverage Diff @@
## main #252 +/- ##
==========================================
+ Coverage 99.10% 99.13% +0.03%
==========================================
Files 58 60 +2
Lines 10038 10386 +348
==========================================
+ Hits 9948 10296 +348
Misses 90 90
Continue to review full report at Codecov.
|
88ee24f
to
5ab0d25
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for another great PR, Simon!
The dirty tracking functionality is really nice and should help us cleaning up some parts of the test environment, too, where we're currently doing some "normalization" of default values.
I left some inline comments. But again, nothing critical.
src/netplan.c
Outdated
} else if (DIRTY(def, def->backend) || | ||
( def->backend != get_default_backend_for_type(np_state->backend, def->type) | ||
&& def->backend != np_state->backend | ||
&& def->backend != NETPLAN_BACKEND_OVS)) { | ||
YAML_STRING_PLAIN(event, emitter, "renderer", netplan_backend_name(def->backend)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not to self: we should verify that this still works correctly with the NM snap integration. It should as parse-nm.c
is setting each netdef's backend to NETPLAN_BACKEND_NM
which is not equal to the default backend type.
This new structure, while more complex, will allow us to extend some callback signatures (i.e. adding a prefix parameter for null-handling) without having to change the whole world. V2: * simplify the map handling structure, getting rid of the tagged union in favor of simpler NULL-handling. * remove the fancy space alignment for the handler declarations as they got out of control.
This will allow us to output those fields even if their value is the default one, to clearly reflect the user's intent. V2: Fix conditional bracing style
If the user touched those fields, we want to retranscribe the value even if it matches the default! Squashed in this commit is a test fix for the on-link field. on-link is a boolean, and its output format was wrong. We want literals as much as possible! The behaviour change is entangled with the dirty changes, so we change the test here. V2: Change the macro names to remove the DIRTY_ bit and make the default values more explicit
5ab0d25
to
877cc35
Compare
This patch rewrites the entire command to use our internal YAML helpers instead, notably the APIs introduced in the few previous commits. This also changes the tests to parse the output YAML instead of checking for a *specific* output, which makes them less susceptible of breaking when there's a small formatting change. V2: * add a test for the networkINVALID query * remove a spurious change in tests/generator/base.py
877cc35
to
713a44b
Compare
Tests run on my local LXD, as GH ACtions seems to be having troubles today:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the V2 improvements and for running the integration tests locally!
LGTM 👀
Description
Port the
netplan get
command to use the internal YAML generator, originally written for the NM-to-netplan system.In order to make this work, we had to add a notion of "dirtyness" to the input data, as the user would want their explicit settings displayed even if they match the default value.
Checklist
make check
successfully.make check-coverage
).