Upgrade netplan to 1.0 (#8560)
Co-authored-by: Francisco Huelsz Prince <frhuelsz@microsoft.com>
This commit is contained in:
Родитель
bad65dc9a3
Коммит
399bc1c0c7
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"Signatures": {
|
||||
"netplan-0.107.1.tar.gz": "b6d4a8f0f2eb7d59887007f12e7d23faa7a55002229e91981f6257ffe8a53017"
|
||||
"netplan-1.0.tar.gz": "863fb083a87d2c6b7dd9d46a9d702fffbb4aaf952c6b1d275016e56b1381527a"
|
||||
}
|
||||
}
|
|
@ -8,11 +8,11 @@
|
|||
%{?!_systemdgeneratordir:%global _systemdgeneratordir /usr/lib/systemd/system-generators}
|
||||
|
||||
# Netplan library soversion major
|
||||
%global libsomajor 0.0
|
||||
%global libsomajor 1
|
||||
|
||||
|
||||
Name: netplan
|
||||
Version: 0.107.1
|
||||
Version: 1.0
|
||||
Release: 1%{?dist}
|
||||
Summary: Network configuration tool using YAML
|
||||
Group: System Environment/Base
|
||||
|
@ -22,18 +22,6 @@ License: GPLv3
|
|||
URL: https://netplan.io/
|
||||
Source0: https://github.com/canonical/%{name}/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
||||
|
||||
# netplan build optionally depends on pyflakes, but there is a hard check for it
|
||||
# in the meson file. This patch disables that check.
|
||||
Patch0: remove-flakes-check.patch
|
||||
|
||||
# Some unit tests require openvswitch to be installed. This is a backported
|
||||
# patch from upstream that adds logic to skip openvswitch tests when it is not
|
||||
# installed. It also removes this dependency from a couple parsing tests that do
|
||||
# not necessarily need openvswitch by replacing the test fixture with another
|
||||
# one that does not require openvswitch to be parsed. See note on
|
||||
# `BuildRequires: openvswitch` below.
|
||||
Patch1: skip-ovs-tests.patch
|
||||
|
||||
# Fix bug in netplan when python3-rich is not present.
|
||||
Patch2: rich-import-failure-no-log.patch
|
||||
|
||||
|
@ -55,14 +43,12 @@ BuildRequires: systemd
|
|||
BuildRequires: systemd-devel
|
||||
BuildRequires: systemd-rpm-macros
|
||||
BuildRequires: util-linux-devel
|
||||
BuildRequires: python%{python3_pkgversion}-pyflakes
|
||||
|
||||
# BuildRequires below are only required for %check:
|
||||
BuildRequires: iproute
|
||||
BuildRequires: libcmocka-devel
|
||||
# Disabled: openvswitch is not building on 3.0 yet. This is only required for
|
||||
# some tests, not blocking the build. Should be enabled once the dependency is
|
||||
# satisfied.
|
||||
# BuildRequires: openvswitch
|
||||
BuildRequires: openvswitch
|
||||
BuildRequires: python%{python3_pkgversion}-cffi
|
||||
BuildRequires: python%{python3_pkgversion}-coverage
|
||||
BuildRequires: python%{python3_pkgversion}-netifaces
|
||||
|
@ -204,9 +190,6 @@ This package configures Netplan to use systemd-networkd as its backend.
|
|||
# /usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: 'ip_str' may be used uninitialized in this function [-Werror=maybe-uninitialized]
|
||||
sed -e "s/werror=true/werror=false/g" -i meson.build
|
||||
|
||||
cp doc/netplan.md doc/netplan.5
|
||||
cp doc/netplan.md doc/netplan.html
|
||||
|
||||
%build
|
||||
|
||||
# python3-coverage provides /usr/bin/coverage3, but the meson config expects it to be called coverage-3
|
||||
|
@ -224,8 +207,6 @@ fi
|
|||
|
||||
# Remove useless "compat" symlink and path
|
||||
rm -f %{buildroot}/lib/netplan/generate
|
||||
rmdir %{buildroot}/lib/netplan
|
||||
rmdir %{buildroot}/lib
|
||||
|
||||
# Remove __pycache__
|
||||
rm -rf %{buildroot}%{python3_sitelib}/%{name}/__pycache__
|
||||
|
@ -247,6 +228,9 @@ chmod 600 %{buildroot}%{_prefix}/lib/%{name}/00-netplan-default-renderer-network
|
|||
%meson_test
|
||||
|
||||
%changelog
|
||||
* Fri Mar 29 2024 Francisco Huelsz prince <frhuelsz@microsoft.com> - 1.0-1
|
||||
- Upgrade to 1.0
|
||||
|
||||
* Thu Feb 15 2024 Francisco Huelsz prince <frhuelsz@microsoft.com> - 0.107.1-1
|
||||
- Upgrade to 0.107.1
|
||||
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
diff --git a/meson.build b/meson.build
|
||||
index 9556836..e78927b 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -75,10 +75,13 @@ if get_option('unit_testing')
|
||||
endif
|
||||
|
||||
#FIXME: exclude doc/env/
|
||||
-test('linting',
|
||||
- pyflakes,
|
||||
- timeout: 100,
|
||||
- args: [meson.current_source_dir()])
|
||||
+
|
||||
+# pyflakes is an optional dependency, this check fails when it is not present
|
||||
+#test('linting',
|
||||
+# pyflakes,
|
||||
+# timeout: 100,
|
||||
+# args: [meson.current_source_dir()])
|
||||
+
|
||||
test('codestyle',
|
||||
pycodestyle,
|
||||
timeout: 100,
|
|
@ -1,163 +0,0 @@
|
|||
# Backport of https://github.com/canonical/netplan/commit/89ba9f21c1e49b97deb9c46122e4c76f4e82faac
|
||||
# for v0.107.1 to fix the testsuite when OpenVSwitch is not installed.
|
||||
#
|
||||
# Some unit-tests might fail when the /usr/bin/ovs-vsctl binary from the
|
||||
# openvswitch-switch is not installed at build time. This can happen primarily
|
||||
# on 32bit architectures where newer versions of OVS are not built anymore.
|
||||
# OVS is not a hard dependency, though. So we can skip/ignore those cases.
|
||||
diff --git a/tests/cli/test_get_set.py b/tests/cli/test_get_set.py
|
||||
index 9e60fc3..459a53d 100644
|
||||
--- a/tests/cli/test_get_set.py
|
||||
+++ b/tests/cli/test_get_set.py
|
||||
@@ -26,6 +26,8 @@ import glob
|
||||
import yaml
|
||||
|
||||
from netplan_cli.cli.commands.set import FALLBACK_FILENAME
|
||||
+from netplan_cli.cli.ovs import OPENVSWITCH_OVS_VSCTL
|
||||
+
|
||||
from netplan import NetplanException
|
||||
from tests.test_utils import call_cli
|
||||
|
||||
@@ -517,6 +519,8 @@ class TestSet(unittest.TestCase):
|
||||
self.assertNotIn('eno2', out['network']['bridges']['br0']['parameters']['port-priority'])
|
||||
self.assertEqual(14, out['network']['bridges']['br0']['parameters']['port-priority']['eno1'])
|
||||
|
||||
+ @unittest.skipIf(not os.path.exists(OPENVSWITCH_OVS_VSCTL),
|
||||
+ 'OpenVSwitch not installed')
|
||||
def test_set_delete_ovs_other_config(self):
|
||||
with open(self.path, 'w') as f:
|
||||
f.write('''network:
|
||||
diff --git a/tests/ctests/test_netplan_parser.c b/tests/ctests/test_netplan_parser.c
|
||||
index 5b1c485..11aab53 100644
|
||||
--- a/tests/ctests/test_netplan_parser.c
|
||||
+++ b/tests/ctests/test_netplan_parser.c
|
||||
@@ -31,7 +31,7 @@ test_netplan_parser_new_parser(__unused void** state)
|
||||
void
|
||||
test_netplan_parser_load_yaml(__unused void** state)
|
||||
{
|
||||
- const char* filename = FIXTURESDIR "/ovs.yaml";
|
||||
+ const char* filename = FIXTURESDIR "/bridge.yaml";
|
||||
GError *error = NULL;
|
||||
NetplanParser* npp = netplan_parser_new();
|
||||
|
||||
@@ -45,7 +45,7 @@ test_netplan_parser_load_yaml(__unused void** state)
|
||||
void
|
||||
test_netplan_parser_load_yaml_from_fd(__unused void** state)
|
||||
{
|
||||
- const char* filename = FIXTURESDIR "/ovs.yaml";
|
||||
+ const char* filename = FIXTURESDIR "/bridge.yaml";
|
||||
FILE* f = fopen(filename, "r");
|
||||
GError *error = NULL;
|
||||
|
||||
diff --git a/tests/generator/test_ovs.py b/tests/generator/test_ovs.py
|
||||
index 1dad3cb..a6ebbcb 100644
|
||||
--- a/tests/generator/test_ovs.py
|
||||
+++ b/tests/generator/test_ovs.py
|
||||
@@ -17,12 +17,18 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
+import os
|
||||
+import unittest
|
||||
+
|
||||
+from netplan_cli.cli.ovs import OPENVSWITCH_OVS_VSCTL
|
||||
from .base import TestBase, ND_EMPTY, ND_WITHIP, ND_DHCP4, ND_DHCP6, \
|
||||
OVS_PHYSICAL, OVS_VIRTUAL, \
|
||||
OVS_BR_EMPTY, OVS_BR_DEFAULT, \
|
||||
OVS_CLEANUP
|
||||
|
||||
|
||||
+@unittest.skipIf(not os.path.exists(OPENVSWITCH_OVS_VSCTL),
|
||||
+ 'OpenVSwitch not installed')
|
||||
class TestOpenVSwitch(TestBase):
|
||||
'''OVS output'''
|
||||
|
||||
diff --git a/tests/test_configmanager.py b/tests/test_configmanager.py
|
||||
index e3b5260..5f2e926 100644
|
||||
--- a/tests/test_configmanager.py
|
||||
+++ b/tests/test_configmanager.py
|
||||
@@ -22,6 +22,7 @@ import tempfile
|
||||
import unittest
|
||||
|
||||
from netplan_cli.configmanager import ConfigManager, ConfigurationError
|
||||
+from netplan_cli.cli.ovs import OPENVSWITCH_OVS_VSCTL
|
||||
|
||||
|
||||
class TestConfigManager(unittest.TestCase):
|
||||
@@ -229,6 +230,8 @@ class TestConfigManager(unittest.TestCase):
|
||||
self.assertIn('eth0', state.ethernets)
|
||||
self.assertIn('eth42', state.ethernets)
|
||||
|
||||
+ @unittest.skipIf(not os.path.exists(OPENVSWITCH_OVS_VSCTL),
|
||||
+ 'OpenVSwitch not installed')
|
||||
def test_parse_merging_ovs(self):
|
||||
state = self.configmanager.parse(extra_config=[os.path.join(self.workdir.name, "ovs_merging.yaml")])
|
||||
self.assertIn('eth0', state.ethernets)
|
||||
diff --git a/tests/test_libnetplan.py b/tests/test_libnetplan.py
|
||||
index 134cfa0..6696cd2 100644
|
||||
--- a/tests/test_libnetplan.py
|
||||
+++ b/tests/test_libnetplan.py
|
||||
@@ -21,6 +21,7 @@ import ctypes
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
+import unittest
|
||||
import io
|
||||
import yaml
|
||||
|
||||
@@ -30,6 +31,7 @@ from tests.test_utils import MockCmd
|
||||
|
||||
from utils import state_from_yaml
|
||||
from netplan_cli.cli.commands.set import FALLBACK_FILENAME
|
||||
+from netplan_cli.cli.ovs import OPENVSWITCH_OVS_VSCTL
|
||||
|
||||
import netplan
|
||||
from netplan.netdef import NetplanRoute
|
||||
@@ -615,6 +617,8 @@ class TestNetDefinition(TestBase):
|
||||
netdef = state['eth0']
|
||||
self.assertEqual(os.path.join(self.confdir, "a.yaml"), netdef.filepath)
|
||||
|
||||
+ @unittest.skipIf(not os.path.exists(OPENVSWITCH_OVS_VSCTL),
|
||||
+ 'OpenVSwitch not installed')
|
||||
def test_filepath_for_ovs_ports(self):
|
||||
state = state_from_yaml(self.confdir, '''network:
|
||||
version: 2
|
||||
@@ -634,6 +638,8 @@ class TestNetDefinition(TestBase):
|
||||
self.assertEqual(os.path.join(self.confdir, "a.yaml"), netdef_port1.filepath)
|
||||
self.assertEqual(os.path.join(self.confdir, "a.yaml"), netdef_port2.filepath)
|
||||
|
||||
+ @unittest.skipIf(not os.path.exists(OPENVSWITCH_OVS_VSCTL),
|
||||
+ 'OpenVSwitch not installed')
|
||||
def test_filepath_for_ovs_ports_when_conf_is_redefined(self):
|
||||
state = netplan.State()
|
||||
parser = netplan.Parser()
|
||||
@@ -793,6 +799,8 @@ class TestNetDefinition(TestBase):
|
||||
|
||||
self.assertIsNone(state['eth0'].links.get('bond'))
|
||||
|
||||
+ @unittest.skipIf(not os.path.exists(OPENVSWITCH_OVS_VSCTL),
|
||||
+ 'OpenVSwitch not installed')
|
||||
def test_interface_has_pointer_to_peer(self):
|
||||
state = state_from_yaml(self.confdir, '''network:
|
||||
openvswitch:
|
||||
diff --git a/tests/test_ovs.py b/tests/test_ovs.py
|
||||
index 5b44a02..c2865e6 100644
|
||||
--- a/tests/test_ovs.py
|
||||
+++ b/tests/test_ovs.py
|
||||
@@ -15,6 +15,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
+import os
|
||||
import unittest
|
||||
|
||||
from unittest.mock import patch, call
|
||||
@@ -26,6 +27,8 @@ from utils import state_from_yaml
|
||||
import tempfile
|
||||
|
||||
|
||||
+@unittest.skipIf(not os.path.exists(OVS),
|
||||
+ 'OpenVSwitch not installed')
|
||||
class TestOVS(unittest.TestCase):
|
||||
|
||||
@patch('subprocess.check_call')
|
|
@ -13902,8 +13902,8 @@
|
|||
"type": "other",
|
||||
"other": {
|
||||
"name": "netplan",
|
||||
"version": "0.107.1",
|
||||
"downloadUrl": "https://github.com/canonical/netplan/archive/refs/tags/0.107.1.tar.gz"
|
||||
"version": "1.0",
|
||||
"downloadUrl": "https://github.com/canonical/netplan/archive/refs/tags/1.0.tar.gz"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче