Skip to content

Commit 3407c3b

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

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

init/ipfixprobed

Lines changed: 23 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,28 @@ 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+
echo $command
147+
148+
if [ $status -ne 0 ]; then
149+
echo "Cannot convert yaml config" >&2
150+
exit $status
151+
fi
152+
exec $command
153+
fi
134154
else
135155
echo "Configuration file '$CONFFILE' does not exist, exitting." >&2
136156
exit 1
137157
fi
158+
159+
exit 0

0 commit comments

Comments
 (0)