bottlerocket
bottlerocket copied to clipboard
netdog: refactor to prepare for upcoming additions
Issue number: Related to #2204
Description of changes: This refactor is in preparation for the upcoming additions related to static addressing.
Almost no code was changed minus the few clippy lints that are in the last commit. The majority of the code was moved around as is.
netdog: Extract lease parsing functions to module
netdog: refactor cli code into modules
Since `main.rs` was starting to get large and unwieldy, and additional
code is expected to be added, this commit refactors all the CLI code
into separate files grouped under a `cli` module.
netdog: implement the suggested clippy lints
Testing done:
- Unit tests continue to pass
- Build and run an
aws-k8s-1.21
image successfully (current_ip
,resolv.conf
,primary_interface
, and/etc/sysctl.d/90-primary_interface.conf
all get properly written)
bash-5.1# cat /etc/sysctl.d/90-primary_interface.conf
-net.ipv6.conf.eth0.accept_ra = 2
-net.ipv4.conf.eth0.rp_filter = 2
- Build and run a
metal-dev
image successfully (net.toml
correctly parsed and all above files written) - Manually run
netdog
's settings generator commands and observe proper output
Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.