From 71b4ff9357aa61521b94acdab0954dfb61891b6c Mon Sep 17 00:00:00 2001 From: Wen Liang Date: Mon, 17 May 2021 18:27:30 -0400 Subject: [PATCH] Replace `setting_type.new()` with `setting_type()` When `setting_type` is `NM.SettingMatch`, `setting_type.new()` will not work because `nm_setting_match_new()` symbol is only exposed and usable since libnm version 1.32 (using `setting_type.new()` is equivalent to call libnm function `nm_setting_*_new()`). Function `setting_type()` will always construct an instance of that `setting_type` and will not need a workaround when `setting_type` is `NM.SettingMatch`. So drop `setting_type.new()` in favor of `setting_type()`. Signed-off-by: Wen Liang --- library/network_connections.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/network_connections.py b/library/network_connections.py index 0023623..e1edc32 100644 --- a/library/network_connections.py +++ b/library/network_connections.py @@ -705,7 +705,7 @@ class NMUtil: def connection_ensure_setting(self, connection, setting_type): setting = connection.get_setting(setting_type) if not setting: - setting = setting_type.new() + setting = setting_type() connection.add_setting(setting) return setting