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
Implement netplan get/set CLI and DBus API #163
Conversation
Codecov Report
@@ Coverage Diff @@
## master #163 +/- ##
==========================================
+ Coverage 88.16% 88.19% +0.02%
==========================================
Files 9 9
Lines 2771 2778 +7
==========================================
+ Hits 2443 2450 +7
Misses 328 328
Continue to review full report at Codecov.
|
fc9522f
to
a9e694a
Compare
cb0c5be
to
ff0b104
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 yet another awesome PR! Love the test coverage btw. This is generally good to go, although I left a few comments inline regarding possible changes and/or improvements.
Thanks again for your very constructive review! I cleaned & fixed up according to your comments. Ready for merge \o/ |
Description
Implements the
netplan get [nested.key] / set nested.key=value
CLI andio.netplan.Netplan.Get() / Set(String configDelta, String originHint)
DBus API.It allows to get/set values from/to the merged netplan configuration as scalar, sequence or mappings.
Validation of settings, added via
netplan set ...
, is done by calling into thelibnetplan
parser using Pythonctypes
. Whereas thenetplan get [...]
command makes use of netplan's Python parser (config_manager). This is to keep it simple for now, unifying the parsers will be for another time...Examples
netplan get
netplan get ethernets.eth0.dhcp4
netplan set ethernets.eth0.dhcp4=true --origin-hint=99_snapd --root-dir=/tmp
netplan set "network.ethernets.eth0={addresses: [1.2.3.4/24], dhcp4: true}"
busctl call io.netplan.Netplan /io/netplan/Netplan io.netplan.Netplan Get
busctl call io.netplan.Netplan /io/netplan/Netplan io.netplan.Netplan Set ss "network.ethernets.eth3={addresses: [5.6.7.8/24], dhcp4: no}" ""
Checklist
make check
successfully.make check-coverage
).