NM.Setting

g GObject.Object GObject.Object NM.Setting NM.Setting GObject.Object->NM.Setting

Subclasses:

NM.Setting6Lowpan, NM.Setting8021x, NM.SettingAdsl, NM.SettingBluetooth, NM.SettingBond, NM.SettingBondPort, NM.SettingBridge, NM.SettingBridgePort, NM.SettingCdma, NM.SettingConnection, NM.SettingDcb, NM.SettingDummy, NM.SettingEthtool, NM.SettingGeneric, NM.SettingGsm, NM.SettingHostname, NM.SettingHsr, NM.SettingIPConfig, NM.SettingIPTunnel, NM.SettingInfiniband, NM.SettingLink, NM.SettingLoopback, NM.SettingMacsec, NM.SettingMacvlan, NM.SettingMatch, NM.SettingOlpcMesh, NM.SettingOvsBridge, NM.SettingOvsDpdk, NM.SettingOvsExternalIDs, NM.SettingOvsInterface, NM.SettingOvsOtherConfig, NM.SettingOvsPatch, NM.SettingOvsPort, NM.SettingPpp, NM.SettingPppoe, NM.SettingProxy, NM.SettingSerial, NM.SettingSriov, NM.SettingTCConfig, NM.SettingTeam, NM.SettingTeamPort, NM.SettingTun, NM.SettingUser, NM.SettingVeth, NM.SettingVlan, NM.SettingVpn, NM.SettingVrf, NM.SettingVxlan, NM.SettingWifiP2P, NM.SettingWimax, NM.SettingWireGuard, NM.SettingWired, NM.SettingWireless, NM.SettingWirelessSecurity, NM.SettingWpan

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

get_enum_property_type (setting_type, property_name)

class

lookup_type (name)

compare (b, flags)

diff (b, flags, invert_results, results)

duplicate ()

enumerate_values (func, *user_data)

get_dbus_property_type (property_name)

get_name ()

get_secret_flags (secret_name, out_flags)

option_clear_by_name (predicate)

option_get (opt_name)

option_get_all_names ()

option_get_boolean (opt_name)

option_get_uint32 (opt_name)

option_set (opt_name, variant)

option_set_boolean (opt_name, value)

option_set_uint32 (opt_name, value)

set_secret_flags (secret_name, flags)

to_string ()

verify (connection)

verify_secrets (connection)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

name

str

r

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class NM.Setting(**kwargs)
Bases:

GObject.Object

Abstract:

Yes

Structure:

NM.SettingClass

classmethod get_enum_property_type(setting_type, property_name)
Parameters:
Returns:

the enum’s GObject.GType, or GObject.TYPE_INVALID if the property is not of enum type

Return type:

GObject.GType

Get the type of the enum that defines the values that the property accepts. It is only useful for properties configured to accept values from certain enum type, otherwise it will return GObject.TYPE_INVALID. Note that flags (children of GObject.TYPE_FLAGS) are also considered enums.

Note that the GObject.Object property might be implemented as an integer, actually, and not as enum. Find out what underlying type is used, checking the GObject.ParamSpec, before setting the GObject.Object property.

New in version 1.46.

classmethod lookup_type(name)
Parameters:

name (str) – a setting name

Returns:

the GObject.GType of the setting’s class, or GObject.TYPE_INVALID if name is not recognized.

Return type:

GObject.GType

Returns the GObject.GType of the setting’s class for a given setting name.

compare(b, flags)
Parameters:
Returns:

True if the comparison succeeds, False if it does not

Return type:

bool

Compares two NM.Setting objects for similarity, with comparison behavior modified by a set of flags. See the documentation for NM.SettingCompareFlags for a description of each flag’s behavior.

diff(b, flags, invert_results, results)
Parameters:
Returns:

True if the settings contain the same values, False if they do not

results:

if the settings differ, on return a hash table mapping the differing keys to one or more NM.SettingDiffResult values OR-ed together. If the settings do not differ, any hash table passed in is unmodified. If no hash table is passed in and the settings differ, a new one is created and returned.

Return type:

(bool, results: {str: int})

Compares two NM.Setting objects for similarity, with comparison behavior modified by a set of flags. See the documentation for NM.SettingCompareFlags for a description of each flag’s behavior. If the settings differ, the keys of each setting that differ from the other are added to results, mapped to one or more NM.SettingDiffResult values.

duplicate()
Returns:

a new NM.Setting containing the same properties and values as the source NM.Setting

Return type:

NM.Setting

Duplicates a NM.Setting.

enumerate_values(func, *user_data)
Parameters:
  • func (NM.SettingValueIterFn) – user-supplied function called for each property of the setting

  • user_data (object or None) – user data passed to func at each invocation

Iterates over each property of the NM.Setting object, calling the supplied user function for each property.

get_dbus_property_type(property_name)
Parameters:

property_name (str) – the property of self to get the type of

Returns:

the D-Bus marshalling type of property on self.

Return type:

GLib.VariantType

Gets the D-Bus marshalling type of a property. property_name is a D-Bus property name, which may not necessarily be a GObject.Object property.

get_name()
Returns:

a string containing the type name of the NM.Setting object, like ‘ppp’ or ‘wireless’ or ‘wired’.

Return type:

str

Returns the type name of the NM.Setting object

get_secret_flags(secret_name, out_flags)
Parameters:
Raises:

GLib.Error

Returns:

True on success (if the given secret name was a valid property of this setting, and if that property is secret), False if not

Return type:

bool

For a given secret, retrieves the NM.SettingSecretFlags describing how to handle that secret.

option_clear_by_name(predicate)
Parameters:

predicate (NM.UtilsPredicateStr or None) – the predicate for which names should be clear. If the predicate returns True for an option name, the option gets removed. If None, all options will be removed.

New in version 1.26.

option_get(opt_name)
Parameters:

opt_name (str) – the option name to request.

Returns:

the GLib.Variant or None if the option is not set.

Return type:

GLib.Variant

New in version 1.26.

option_get_all_names()
Returns:

A None terminated array of key names. If no names are present, this returns None. The returned array and the names are owned by NM.Setting and might be invalidated by the next operation.

Return type:

[str] or None

Gives the name of all set options.

New in version 1.26.

option_get_boolean(opt_name)
Parameters:

opt_name (str) – the option to get

Returns:

True if opt_name is set to a boolean variant.

out_value:

the optional output value. If the option is unset, False will be returned.

Return type:

(bool, out_value: bool)

New in version 1.26.

option_get_uint32(opt_name)
Parameters:

opt_name (str) – the option to get

Returns:

True if opt_name is set to a uint32 variant.

out_value:

the optional output value. If the option is unset, 0 will be returned.

Return type:

(bool, out_value: int)

New in version 1.26.

option_set(opt_name, variant)
Parameters:
  • opt_name (str) – the option name to set

  • variant (GLib.Variant or None) – the variant to set.

If variant is None, this clears the option if it is set. Otherwise, variant is set as the option. If variant is a floating reference, it will be consumed.

Note that not all setting types support options. It is a bug setting a variant to a setting that doesn’t support it. Currently, only NM.SettingEthtool supports it.

New in version 1.26.

option_set_boolean(opt_name, value)
Parameters:
  • opt_name (str) –

  • value (bool) – the value to set.

Like NM.Setting.option_set() to set a boolean GLib.Variant.

New in version 1.26.

option_set_uint32(opt_name, value)
Parameters:
  • opt_name (str) –

  • value (int) – the value to set.

Like NM.Setting.option_set() to set a uint32 GLib.Variant.

New in version 1.26.

set_secret_flags(secret_name, flags)
Parameters:
Raises:

GLib.Error

Returns:

True on success (if the given secret name was a valid property of this setting, and if that property is secret), False if not

Return type:

bool

For a given secret, stores the NM.SettingSecretFlags describing how to handle that secret.

to_string()
Returns:

an allocated string containing a textual representation of the setting’s properties and values, which the caller should free with GLib.free()

Return type:

str

Convert the setting (including secrets!) into a string. For debugging purposes ONLY, should NOT be used for serialization of the setting, or machine-parsed in any way. The output format is not guaranteed to be stable and may change at any time.

verify(connection)
Parameters:

connection (NM.Connection or None) – the NM.Connection that self came from, or None if self is being verified in isolation.

Raises:

GLib.Error

Returns:

True if the setting is valid, False if it is not

Return type:

bool

Validates the setting. Each setting’s properties have allowed values, and some are dependent on other values (hence the need for connection). The returned GLib.Error contains information about which property of the setting failed validation, and in what way that property failed validation.

verify_secrets(connection)
Parameters:

connection (NM.Connection or None) – the NM.Connection that self came from, or None if self is being verified in isolation.

Raises:

GLib.Error

Returns:

True if the setting secrets are valid, False if they are not

Return type:

bool

Verifies the secrets in the setting. The returned GLib.Error contains information about which secret of the setting failed validation, and in what way that secret failed validation. The secret validation is done separately from main setting validation, because in some cases connection failure is not desired just for the secrets.

New in version 1.2.

Property Details

NM.Setting.props.name
Name:

name

Type:

str

Default Value:

None

Flags:

READABLE

The setting’s name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example “ppp” or “802-11-wireless” or “802-3-ethernet”.