Skip to content

hetzner: Tighter regex match for INTERFACE_DEVICE_PATH #18

@nh2

Description

@nh2

I found a case on a Hetzner SX134 server with an addiitonal 10 G network interface that in

INTERFACE_DEVICE_PATH=$(udevadm info -e | grep -Po "(?<=^P: )(.*${RESCUE_INTERFACE})")

we need

-INTERFACE_DEVICE_PATH=$(udevadm info -e | grep -Po "(?<=^P: )(.*${RESCUE_INTERFACE})")
+INTERFACE_DEVICE_PATH=$(udevadm info -e | grep -Po "(?<=^P: )(.*${RESCUE_INTERFACE})$")

Otherwise we can get two maches:

# udevadm info -e | grep -P "(?<=^P: )(.*eth1)"
P: /devices/pci0000:00/0000:00:01.1/0000:01:00.0/net/eth1
P: /devices/pci0000:00/0000:00:01.1/0000:01:00.0/net/eth1/ixgbe-mdio-0000:01:00.0

when in fact we want to match only the first line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions