-
Notifications
You must be signed in to change notification settings - Fork 85
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
Update to zbus 4 #1025
base: main
Are you sure you want to change the base?
Update to zbus 4 #1025
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: nc7s The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Note you have validate failures (make validate) that have to be fixed. @mheon PTAL |
I'm still thinking we replace zbus entirely with a simpler library at some point, but I have no objection to merging this in the interim. |
Changes look fine once you can get CI to pass. |
centos9_build and ubuntu20_build failed because the zbus & zvariant 4 series require rustc 1.75; if you don't want to lift build requirements that's a hard no I guess. |
That should not a problem, they are ancient and mostly useless anyway as nobody takes care of these build images We need to merge #1015 and then I guess we should just drop ubuntu job as well |
Also diff --git a/src/firewall/firewalld.rs b/src/firewall/firewalld.rs
index ab2dcaf..501eb4f 100644
--- a/src/firewall/firewalld.rs
+++ b/src/firewall/firewalld.rs
@@ -129,7 +129,7 @@ impl firewall::FirewallDriver for FirewallD {
&(PORTPOLICYNAME),
)?;
let body = policy_config_msg.body();
- let policy_config: HashMap<&str, Value> = body.deserialize().map_err(|e| {
+ let mut policy_config: HashMap<&str, Value> = body.deserialize().map_err(|e| {
NetavarkError::wrap(
format!("Error decoding DBus message for policy {PORTPOLICYNAME} configuration"),
e.into(),
@@ -137,17 +137,15 @@ impl firewall::FirewallDriver for FirewallD {
})?;
let mut port_forwarding_rules: Array;
- match policy_config.get("forward_ports") {
+ match policy_config.remove("forward_ports") {
Some(a) => {
port_forwarding_rules = if let Value::Array(arr) = a {
- Some(arr)
+ arr
} else {
- None
- }
- .and_then(|arr| arr.try_clone().ok())
- .ok_or_else(|| {
- NetavarkError::msg("forward-port in firewalld policy object has a bad type")
- })?
+ return Err(NetavarkError::msg(
+ "forward-port in firewalld policy object has a bad type",
+ ));
+ };
}
None => {
// No existing rules You can do the same for the other policy_config.get() call I am sure there are more tricks to avoid some more clones. |
Updated with @Luap99's suggestions; I think I'll leave further refactoring out of this PR ;) |
Signed-off-by: Blair Noctis <[email protected]>
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
This PR was basically done in containers#1025 by a contributor Blair Noctis. His PR got stuck in a rebase problem and I have simply taken his diff and worked out the rebasing issue. Thanks so much to Blair for his work. Signed-off-by: Brent Baude <[email protected]>
This PR was basically done in containers#1025 by a contributor Blair Noctis. His PR got stuck in a rebase problem and I have simply taken his diff and worked out the rebasing issue. Thanks so much to Blair for his work. Signed-off-by: Blair Noctis <[email protected]> Signed-off-by: Brent Baude <[email protected]>
Mainly adapting to API changes.
Especially note the error messages, I'm certainly not knowledgeable enough to properly write them, plus there's one with TODO.
There is an apparent repeating pattern (below), which I feel suboptimal, but can't yet find a better alternative. Please enlighten me if you can.