Skip to content

Commit 6e4ed4a

Browse files
author
Pavel Siska
committed
ipfixprobed: update ipfixprobed script to support new yaml configuration
format
1 parent 9feafd3 commit 6e4ed4a

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

init/ipfixprobed

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
CONFFILE="/etc/ipfixprobe/$1.conf"
44

5-
if [ -e "$CONFFILE" ]; then
5+
parse_old_format() {
6+
# Parse the old format of the configuration file
67
source "$CONFFILE"
78
input=""
89
dpdkinput=""
@@ -131,7 +132,26 @@ if [ -e "$CONFFILE" ]; then
131132
fi
132133

133134
exec /usr/bin/ipfixprobe "${dpdkinput[@]}" $input $storage $process $output $telemetry $EXTRA_ARGS
135+
}
136+
137+
if [ -e "$CONFFILE" ]; then
138+
if grep -q 'INPUT\[' $CONFFILE; then
139+
echo "WARNING: Legacy configuration format detected. This format is obsolete and will be removed in version 5.2."
140+
echo "Please transition to the new YAML configuration format. For more details, visit: https://github.com/CESNET/ipfixprobe/blob/master/init/link0.conf.example"
141+
parse_old_format
142+
else
143+
command=$(python3 config2args.py --config $CONFFILE)
144+
status=$?
145+
146+
if [ $status -ne 0 ]; then
147+
echo "Cannot convert yaml config" >&2
148+
exit $status
149+
fi
150+
exec $command
151+
fi
134152
else
135153
echo "Configuration file '$CONFFILE' does not exist, exitting." >&2
136154
exit 1
137155
fi
156+
157+
exit 0

0 commit comments

Comments
 (0)