Upgrade to 2.2.7

Resolves: RHBZ#2166580

Signed-off-by: Gris Ge <fge@redhat.com>
This commit is contained in:
Gris Ge 2023-02-17 18:53:17 +08:00
parent e724a6a728
commit be0780294a
4 changed files with 11 additions and 77 deletions

3
.gitignore vendored
View File

@ -158,3 +158,6 @@
/nmstate-2.2.6.tar.gz
/nmstate-2.2.6.tar.gz.asc
/nmstate-vendor-2.2.6.tar.xz
/nmstate-2.2.7.tar.gz
/nmstate-2.2.7.tar.gz.asc
/nmstate-vendor-2.2.7.tar.xz

View File

@ -1,72 +0,0 @@
From ae3f45a725cb2639ef9e4c6fab1aead0debe7c29 Mon Sep 17 00:00:00 2001
From: Gris Ge <fge@redhat.com>
Date: Tue, 10 Jan 2023 19:56:23 +0800
Subject: [PATCH] ovsdb: Fix verification error when ovs daemon off
When applying `ovs-db: {}` with ovs daemon stopped, nmstate will fail
with:
NmstateError: VerificationError: Verification failure:
ovsdb.external_ids desire '{}', current 'null'
Fixed by treating `ovs-db: {}` as
```yml
ovs-db:
external_ids: {}
other_config: {}
```
Unit test case and integration test case included.
Signed-off-by: Gris Ge <fge@redhat.com>
---
rust/src/lib/query_apply/ovs.rs | 11 ++++++++++-
rust/src/lib/unit_tests/ovsdb.rs | 11 +++++++++++
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/rust/src/lib/query_apply/ovs.rs b/rust/src/lib/query_apply/ovs.rs
index c1e0cf2e..13c4079d 100644
--- a/rust/src/lib/query_apply/ovs.rs
+++ b/rust/src/lib/query_apply/ovs.rs
@@ -30,8 +30,17 @@ impl MergedOvsDbGlobalConfig {
other_config: Some(other_config),
prop_list: vec!["external_ids", "other_config"],
};
+
let desired_value = serde_json::to_value(&desired)?;
- let current_value = serde_json::to_value(current)?;
+ let current_value = if current.is_none() {
+ serde_json::to_value(&OvsDbGlobalConfig {
+ external_ids: Some(HashMap::new()),
+ other_config: Some(HashMap::new()),
+ prop_list: Vec::new(),
+ })?
+ } else {
+ serde_json::to_value(current)?
+ };
if let Some((reference, desire, current)) = get_json_value_difference(
"ovsdb".to_string(),
diff --git a/rust/src/lib/unit_tests/ovsdb.rs b/rust/src/lib/unit_tests/ovsdb.rs
index 1c9618a2..698f1a65 100644
--- a/rust/src/lib/unit_tests/ovsdb.rs
+++ b/rust/src/lib/unit_tests/ovsdb.rs
@@ -156,3 +156,14 @@ other_config: {}
expect.other_config.as_ref().unwrap()
);
}
+
+#[test]
+fn test_ovsdb_verify_null_current() {
+ let desired: OvsDbGlobalConfig = serde_yaml::from_str("{}").unwrap();
+ let pre_apply_current = desired.clone();
+ let current = desired.clone();
+
+ let merged_ovsdb = MergedOvsDbGlobalConfig::new(desired, pre_apply_current);
+
+ merged_ovsdb.verify(&current).unwrap();
+}
--
2.39.0

View File

@ -3,7 +3,7 @@
%define libname libnmstate
Name: nmstate
Version: 2.2.6
Version: 2.2.7
Release: 1%{?dist}
Summary: Declarative network manager API
License: LGPLv2+
@ -150,6 +150,9 @@ popd
/sbin/ldconfig
%changelog
* Fri Feb 17 2023 Gris Ge <fge@redhat.com> - 2.2.7-1
- Upgrade to 2.2.7
* Thu Feb 09 2023 Fernando Fernandez Mancera <ferferna@redhat.com> - 2.2.6-1
- Upgrade to 2.2.6

View File

@ -1,4 +1,4 @@
SHA512 (nmstate-2.2.6.tar.gz) = 4844aa94d9eca98b24269e232f909d986957b9b89a9e14a9c1fac1dde7b30979fc1e3f5a573208f718e2df29e4a1f35da46740294b05d7ed74a742c7e66c4c83
SHA512 (nmstate-2.2.6.tar.gz.asc) = eee971b3cea94f8a28bc96c16e11f8d4a6d04c9da4a02184b8f55eacfae8dd153f17b2d261c0c0eebc4305a7e708104cb3547410000da8d4c924a9c8fbd353a7
SHA512 (nmstate-vendor-2.2.6.tar.xz) = c3bbb4f062fefd859d3e68f5ce23fe624fb47855183cb5236f1b6cf444899915bc4b47e0596ca0d0d099701c60f0251b43c2ae12d2613daf2284248ff9bb4a5a
SHA512 (nmstate.gpg) = 2e211f2268a412036d71b90bb37aab5a30c1a69a9ff85debbad703bc018183890b4a3e38b00b96b4d8392dc739e8cdec0d891e220c04d61289c384f1bbbef5cb
SHA512 (nmstate-2.2.7.tar.gz) = c17cfe78deccc1fbc5f0f33213ea0d7414abdd93e07011a2768fea30a8c50446c39714b4a64c992ddae4f7fbd7d4648e6e13cb9c8ddb7414ecd94dca07ee7bf7
SHA512 (nmstate-2.2.7.tar.gz.asc) = 9ca0ed874ad78dbea0ca02f7db48e937047297d9e2ae53ccf5a66c4a8afe00d2fab6d53ee446b997b9ab915edc501bc34e51808551dfd0e1f85b52cc6fd1ec0c
SHA512 (nmstate-vendor-2.2.7.tar.xz) = 78180a0906728154d86b142216e87b36e309773cecbcc027cfd207b958cba2e7c7fe5d741eee6bc327ea0d019925212322e30f74bf8529c06c8d56e875e7a40d
SHA512 (nmstate.gpg) = 91c6b1d8aef4944520d4bdd4e90121bbbbaf772444f5eb6081cee81e17b21b66798437cdc09a117c6fc77c54d798aaa30400857aa090cb2102b47841f45cf6eb