mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 02:15:17 +00:00
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 <liangwen12year@gmail.com>
This commit is contained in:
parent
46ff0ece04
commit
71b4ff9357
1 changed files with 1 additions and 1 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue