Skip to content

Commit f0e16b1

Browse files
committed
fix(interface-onboot.sh): fix processing of ifcfg options with quotes or different case
Change-Id: Ied25e2d8f15f68d38de47e5f5138faa5221a53fb
1 parent 89fd7d2 commit f0e16b1

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

env-for-debug.sh

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# Folder for risu
99
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1010
export RISU_BASE=${DIR}/risuclient/
11+
export CITELLUS_BASE=${RISU_BASE}
1112

1213
# Error code definition
1314
export RC_OKAY=10
@@ -22,9 +23,11 @@ export TEXTDOMAINDIR=${RISU_BASE}/locale
2223

2324
# Root directory for sosreport
2425
export RISU_ROOT=.
26+
export CITELLUS_ROOT=${RISU_ROOT}
2527

2628
# Force to run non-live
2729
export RISU_LIVE=0
30+
export CITELLUS_LIVE=${RISU_LIVE}
2831

2932
# Load common functions
3033
. ${RISU_BASE}/common-functions.sh

risuclient/plugins/core/network/interface-onboot.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ RC_STATUS=${RC_OKAY}
5151

5252
# Sometimes NIC might have a fancy name instead of ifcfg-$IFNAME, use MACs for matching
5353
MACS_IN_SYSTEM=$(grep -i -a2 "state UP" ${IP_ADDRESS_FILE} | grep ether | awk '{print $2}' | sort -u)
54-
IFACES_IN_SYSTEM=$(grep -i "state UP" ${IP_ADDRESS_FILE} | cut -f2 -d ":")
54+
IFACES_IN_SYSTEM=$(grep -i "state UP" ${IP_ADDRESS_FILE} | cut -f2 -d ":" | tr -d " ")
5555
declare -A IFACES_MACS
5656

5757
for iface in ${IFACES_IN_SYSTEM}; do
@@ -74,8 +74,9 @@ for iface in ${IFACES_IN_SYSTEM}; do
7474
for ifacefile in ${RISU_ROOT}/etc/sysconfig/network-scripts/ifcfg-*; do
7575
if is_lineinfile ${iface} ${ifacefile}; then
7676
NETWORK_INTERFACE_FILE=${ifacefile}
77-
if ! is_lineinfile 'onboot=yes' ${NETWORK_INTERFACE_FILE}; then
78-
echo "Interface '$interface_name' up but not 'onboot=YES' in the ${NETWORK_INTERFACE_FILE} file!" >&2
77+
status=$(cat ${NETWORK_INTERFACE_FILE} | grep -i onboot | grep -v ^# | cut -d "=" -f 2- | xargs echo | tr "[:upper:]" "[:lower:]")
78+
if [ ${status} != "yes" ]; then
79+
echo "Interface '${iface}' up but not 'onboot=YES' in the ${NETWORK_INTERFACE_FILE} file!" >&2
7980
RC_STATUS=${RC_FAILED}
8081
fi
8182
fi

0 commit comments

Comments
 (0)