From 4d3e3210658833731685f10e210db5933a5462ac Mon Sep 17 00:00:00 2001 From: yzamir Date: Thu, 29 Aug 2024 19:59:26 +0300 Subject: [PATCH] gured from missing nm directories Signed-off-by: yzamir --- .../cold/scripts/rhel/run/network_config_util.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/virt-v2v/cold/scripts/rhel/run/network_config_util.sh b/virt-v2v/cold/scripts/rhel/run/network_config_util.sh index 52cbc9549..33b8cc30d 100644 --- a/virt-v2v/cold/scripts/rhel/run/network_config_util.sh +++ b/virt-v2v/cold/scripts/rhel/run/network_config_util.sh @@ -36,6 +36,12 @@ extract_mac_ip() { # Create udev rules based on the macToip mapping + ifcfg network scripts udev_from_ifcfg() { + # Check if the network scripts directory exists + if [[ ! -d "$NETWORK_SCRIPTS_DIR" ]]; then + echo "Warning: Directory $NETWORK_SCRIPTS_DIR does not exist." >&2 + return 0 + fi + # Read the mapping file line by line while IFS= read -r line; do # Extract S_HW and S_IP @@ -56,6 +62,12 @@ udev_from_ifcfg() { # Create udev rules based on the macToip mapping + network manager connections udev_from_nm() { + # Check if the network connections directory exists + if [[ ! -d "$NETWORK_CONNECTIONS_DIR" ]]; then + echo "Warning: Directory $NETWORK_CONNECTIONS_DIR does not exist." >&2 + return 0 + fi + # Read the mapping file line by line while IFS= read -r line; do # Extract S_HW and S_IP