HomeVyOS Platform

vyos.util: extend process_named_running() signature with cmdline

Description

vyos.util: extend process_named_running() signature with cmdline

process_named_running() was introduced in commit 16b2fc8fc4ca ("dns-forwarding:
T2298: fix path to control file") and thus remained more or less unchanged.

Smoketests use process_named_running() heavily and might spawn multiple
processes with the same name but ifferent options (e.g. dhcp6c or dhclient) and
it was yet not possible to properly filter on the "real-deal" like the process
bound to a given interface.

One can now optionally specify a string that is searched inside the command
line argument list of the process.

Example:

process_named_running('dhcp6c', 'veth0')

['/usr/sbin/dhcp6c', '-D', '-k', '/run/dhcp6c/dhcp6c.veth0.sock', '-c',
'/run/dhcp6c/dhcp6c.veth0.conf', '-p', '/run/dhcp6c/dhcp6c.veth0.pid', 'veth0']
4215

process_named_running('dhcp6c', 'veth1')

['/usr/sbin/dhcp6c', '-D', '-k', '/run/dhcp6c/dhcp6c.veth1.sock', '-c',
'/run/dhcp6c/dhcp6c.veth1.conf', '-p', '/run/dhcp6c/dhcp6c.veth1.pid', 'veth1']
4253

Where the debug list returned is the commandline searched.

Details

Provenance
c-poAuthored on May 28 2023, 7:14 PM
Parents
rVYOSONEX1c83615492b6: ipsec: T5042: fix remote-access "Tunnel IP" column
Branches
Loading...
Tags
Loading...