mirror of
https://github.com/linux-system-roles/network.git
synced 2026-07-20 17:59:00 +00:00
module: use introspection variables instead of plain strings for setting names
This commit is contained in:
parent
f5ee8a7e1c
commit
cff6989606
1 changed files with 11 additions and 5 deletions
|
|
@ -749,11 +749,15 @@ class NMUtil:
|
|||
)
|
||||
|
||||
if connection["type"] == "ethernet":
|
||||
s_con.set_property(NM.SETTING_CONNECTION_TYPE, "802-3-ethernet")
|
||||
s_con.set_property(
|
||||
NM.SETTING_CONNECTION_TYPE, NM.SETTING_WIRED_SETTING_NAME
|
||||
)
|
||||
s_wired = self.connection_ensure_setting(con, NM.SettingWired)
|
||||
s_wired.set_property(NM.SETTING_WIRED_MAC_ADDRESS, connection["mac"])
|
||||
elif connection["type"] == "infiniband":
|
||||
s_con.set_property(NM.SETTING_CONNECTION_TYPE, "infiniband")
|
||||
s_con.set_property(
|
||||
NM.SETTING_CONNECTION_TYPE, NM.SETTING_INFINIBAND_SETTING_NAME
|
||||
)
|
||||
s_infiniband = self.connection_ensure_setting(con, NM.SettingInfiniband)
|
||||
s_infiniband.set_property(
|
||||
NM.SETTING_INFINIBAND_MAC_ADDRESS, connection["mac"]
|
||||
|
|
@ -774,17 +778,19 @@ class NMUtil:
|
|||
),
|
||||
)
|
||||
elif connection["type"] == "bridge":
|
||||
s_con.set_property(NM.SETTING_CONNECTION_TYPE, "bridge")
|
||||
s_con.set_property(
|
||||
NM.SETTING_CONNECTION_TYPE, NM.SETTING_BRIDGE_SETTING_NAME
|
||||
)
|
||||
s_bridge = self.connection_ensure_setting(con, NM.SettingBridge)
|
||||
s_bridge.set_property(NM.SETTING_BRIDGE_STP, False)
|
||||
elif connection["type"] == "bond":
|
||||
s_con.set_property(NM.SETTING_CONNECTION_TYPE, "bond")
|
||||
s_con.set_property(NM.SETTING_CONNECTION_TYPE, NM.SETTING_BOND_SETTING_NAME)
|
||||
s_bond = self.connection_ensure_setting(con, NM.SettingBond)
|
||||
s_bond.add_option("mode", connection["bond"]["mode"])
|
||||
if connection["bond"]["miimon"] is not None:
|
||||
s_bond.add_option("miimon", str(connection["bond"]["miimon"]))
|
||||
elif connection["type"] == "team":
|
||||
s_con.set_property(NM.SETTING_CONNECTION_TYPE, "team")
|
||||
s_con.set_property(NM.SETTING_CONNECTION_TYPE, NM.SETTING_TEAM_SETTING_NAME)
|
||||
elif connection["type"] == "vlan":
|
||||
s_vlan = self.connection_ensure_setting(con, NM.SettingVlan)
|
||||
s_vlan.set_property(NM.SETTING_VLAN_ID, connection["vlan"]["id"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue