NM.SettingMatch

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

Subclasses:

None

Methods

Inherited:

NM.Setting (21), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

add_driver (driver)

add_interface_name (interface_name)

add_kernel_command_line (kernel_command_line)

add_path (path)

clear_drivers ()

clear_interface_names ()

clear_kernel_command_lines ()

clear_paths ()

get_driver (idx)

get_drivers ()

get_interface_name (idx)

get_interface_names ()

get_kernel_command_line (idx)

get_kernel_command_lines ()

get_num_drivers ()

get_num_interface_names ()

get_num_kernel_command_lines ()

get_num_paths ()

get_path (idx)

get_paths ()

remove_driver (idx)

remove_driver_by_value (driver)

remove_interface_name (idx)

remove_interface_name_by_value (interface_name)

remove_kernel_command_line (idx)

remove_kernel_command_line_by_value (kernel_command_line)

remove_path (idx)

remove_path_by_value (path)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Inherited:

NM.Setting (1)

Name

Type

Flags

Short Description

driver

[str]

r/w/en

interface-name

[str]

r/w/en

kernel-command-line

[str]

r/w/en

path

[str]

r/w/en

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class NM.SettingMatch(**kwargs)
Bases:

NM.Setting

Abstract:

No

Structure:

NM.SettingMatchClass

Match settings

New in version 1.14.

classmethod new()
Returns:

the new empty NM.SettingMatch object

Note that this function was present in header files since version 1.14. But due to a bug the symbol is only exposed and usable since version 1.32. As workaround, use g_object_new(NM_TYPE_SETTING_MATCH) which works with all versions since 1.14.

Return type:

NM.Setting

Creates a new NM.SettingMatch object with default values.

New in version 1.32.

add_driver(driver)
Parameters:

driver (str) – the driver to add

Adds a new driver to the setting.

New in version 1.26.

add_interface_name(interface_name)
Parameters:

interface_name (str) – the interface name to add

Adds a new interface name to the setting.

New in version 1.14.

add_kernel_command_line(kernel_command_line)
Parameters:

kernel_command_line (str) – the kernel command line argument to add

Adds a new kernel command line argument to the setting.

New in version 1.26.

add_path(path)
Parameters:

path (str) – the path to add

Adds a new path to the setting.

New in version 1.26.

clear_drivers()

Removes all configured drivers.

New in version 1.26.

clear_interface_names()

Removes all configured interface names.

New in version 1.14.

clear_kernel_command_lines()

Removes all configured kernel command line arguments.

New in version 1.26.

clear_paths()

Removes all configured paths.

New in version 1.26.

get_driver(idx)
Parameters:

idx (int) – index number of the DNS search domain to return

Returns:

the driver at index idx

Return type:

str

Since 1.46, access at index “len” is allowed and returns None.

New in version 1.26.

get_drivers()
Returns:

the configured drivers.

Return type:

[str]

Returns all the drivers.

New in version 1.26.

get_interface_name(idx)
Parameters:

idx (int) – index number of the DNS search domain to return

Returns:

the interface name at index idx

Return type:

str

Since 1.46, access at index “len” is allowed and returns None.

New in version 1.14.

get_interface_names()
Returns:

the None terminated list of configured interface names.

Before 1.26, the returned array was not None terminated and you MUST provide a length.

Return type:

[str]

Returns all the interface names.

New in version 1.14.

get_kernel_command_line(idx)
Parameters:

idx (int) – index number of the kernel command line argument to return

Returns:

the kernel command line argument at index idx

Return type:

str

Since 1.46, access at index “len” is allowed and returns None.

New in version 1.26.

get_kernel_command_lines()
Returns:

the configured interface names.

Return type:

[str]

Returns all the interface names.

New in version 1.26.

get_num_drivers()
Returns:

the number of configured drivers

Return type:

int

New in version 1.26.

get_num_interface_names()
Returns:

the number of configured interface names

Return type:

int

New in version 1.14.

get_num_kernel_command_lines()
Returns:

the number of configured kernel command line arguments

Return type:

int

New in version 1.26.

get_num_paths()
Returns:

the number of configured paths

Return type:

int

New in version 1.26.

get_path(idx)
Parameters:

idx (int) – index number of the path to return

Returns:

the path at index idx

Return type:

str

Since 1.46, access at index “len” is allowed and returns None.

New in version 1.26.

get_paths()
Returns:

the configured paths.

Return type:

[str]

Returns all the paths.

New in version 1.26.

remove_driver(idx)
Parameters:

idx (int) – index number of the driver

Removes the driver at index idx.

New in version 1.26.

remove_driver_by_value(driver)
Parameters:

driver (str) – the driver to remove

Returns:

True if the driver was found and removed; False if it was not.

Return type:

bool

Removes driver.

New in version 1.26.

remove_interface_name(idx)
Parameters:

idx (int) – index number of the interface name

Removes the interface name at index idx.

New in version 1.14.

remove_interface_name_by_value(interface_name)
Parameters:

interface_name (str) – the interface name to remove

Returns:

True if the interface name was found and removed; False if it was not.

Return type:

bool

Removes interface_name.

New in version 1.14.

remove_kernel_command_line(idx)
Parameters:

idx (int) – index number of the kernel command line argument

Removes the kernel command line argument at index idx.

New in version 1.26.

remove_kernel_command_line_by_value(kernel_command_line)
Parameters:

kernel_command_line (str) – the kernel command line argument name to remove

Returns:

True if the kernel command line argument was found and removed; False if it was not.

Return type:

bool

Removes kernel_command_line.

New in version 1.26.

remove_path(idx)
Parameters:

idx (int) – index number of the path

Removes the path at index idx.

New in version 1.26.

remove_path_by_value(path)
Parameters:

path (str) – the path to remove

Returns:

True if the path was found and removed; False if it was not.

Return type:

bool

Removes path.

New in version 1.26.

Property Details

NM.SettingMatch.props.driver
Name:

driver

Type:

[str]

Default Value:

[]

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

A list of driver names to match. Each element is a shell wildcard pattern.

See NM.SettingMatch :interface-name for how special characters ‘|’, ‘&’, ‘!’ and ‘\\’ are used for optional and mandatory matches and inverting the pattern.

New in version 1.26.

NM.SettingMatch.props.interface_name
Name:

interface-name

Type:

[str]

Default Value:

[]

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

A list of interface names to match. Each element is a shell wildcard pattern.

An element can be prefixed with a pipe symbol (|) or an ampersand (&). The former means that the element is optional and the latter means that it is mandatory. If there are any optional elements, than the match evaluates to true if at least one of the optional element matches (logical OR). If there are any mandatory elements, then they all must match (logical AND). By default, an element is optional. This means that an element “foo” behaves the same as “|foo”. An element can also be inverted with exclamation mark (!) between the pipe symbol (or the ampersand) and before the pattern. Note that “!foo” is a shortcut for the mandatory match “&!foo”. Finally, a backslash can be used at the beginning of the element (after the optional special characters) to escape the start of the pattern. For example, “&\\!a” is an mandatory match for literally “!a”.

New in version 1.14.

NM.SettingMatch.props.kernel_command_line
Name:

kernel-command-line

Type:

[str]

Default Value:

[]

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

A list of kernel command line arguments to match. This may be used to check whether a specific kernel command line option is set (or unset, if prefixed with the exclamation mark). The argument must either be a single word, or an assignment (i.e. two words, joined by “=”). In the former case the kernel command line is searched for the word appearing as is, or as left hand side of an assignment. In the latter case, the exact assignment is looked for with right and left hand side matching. Wildcard patterns are not supported.

See NM.SettingMatch :interface-name for how special characters ‘|’, ‘&’, ‘!’ and ‘\\’ are used for optional and mandatory matches and inverting the match.

New in version 1.26.

NM.SettingMatch.props.path
Name:

path

Type:

[str]

Default Value:

[]

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

A list of paths to match against the ID_PATH udev property of devices. ID_PATH represents the topological persistent path of a device. It typically contains a subsystem string (pci, usb, platform, etc.) and a subsystem-specific identifier.

For PCI devices the path has the form “pci-$domain:$bus:$device.$function”, where each variable is an hexadecimal value; for example “pci-0000:0a:00.0”.

The path of a device can be obtained with “udevadm info /sys/class/net/$dev | grep ID_PATH=” or by looking at the “path” property exported by NetworkManager (“nmcli -f general.path device show $dev”).

Each element of the list is a shell wildcard pattern.

See NM.SettingMatch :interface-name for how special characters ‘|’, ‘&’, ‘!’ and ‘\\’ are used for optional and mandatory matches and inverting the pattern.

New in version 1.26.