-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
package_managers: rpm: Allow specifying DNF options via CLI input JSON
Introduce a new input JSON attribute 'options' for the PoC rpm package manager allowing consumers to pass arbitrary DNF repo configuration options that would be applied later through the inject-files command. The general schema for the input JSON is as follows: { type: <package_manager> path: <relative_path> options: { <namespace>: { <key1>..<keyN>: Union[str, Any]<val1> } } } which translated to DNF repo options for RPM might then look like: { type: rpm path: . options: { dnf: { repoid1: {gpgcheck: 0, deltarpm: 1}, repoid2: {fastestmirro: 1, sslverify: 0} } } } This implementation is trying to be generic enough to be potentially later extended to other package managers as well which also means that due to the fairly complex (multi-level nested dictionary) input a new intermediary model _DNFOptions was needed to be introduced in this patch, but most importantly a custom 'before' model validator for this model had to be implemented to generate stable and deterministic errors which could be reliably unit-tested (default pydantic error messages for such complex structures are madness). Worth noting would be that unless options were specified, they would not appear in the build-config.json --> exclude_none=True Signed-off-by: Erik Skultety <[email protected]>
- Loading branch information
Showing
7 changed files
with
264 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.