From: Razvan Becheriu Date: Fri, 12 May 2023 11:30:47 +0000 (+0300) Subject: [#2822] fixed check tool and documentation X-Git-Tag: Kea-2.3.8~143 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b554368e0ce5e5e1511cbb62d6f632ac90552625;p=thirdparty%2Fkea.git [#2822] fixed check tool and documentation --- diff --git a/doc/sphinx/arm/ctrl-channel.rst b/doc/sphinx/arm/ctrl-channel.rst index e53943b96f..e9a6b971c0 100644 --- a/doc/sphinx/arm/ctrl-channel.rst +++ b/doc/sphinx/arm/ctrl-channel.rst @@ -100,7 +100,7 @@ is mandatory. The ``arguments`` map contains the parameters required to carry out the given command. The exact content and format of the map are command-specific. -``service`` is a list of the servers at which the control command is +The ``service`` list contains the servers at which the control command is targeted. In the example above, the control command is targeted at the DHCPv4 server. In most cases, the CA simply forwards this command to the DHCPv4 server for processing via a UNIX domain socket. Sometimes, @@ -122,9 +122,9 @@ by the receiving server. This parameter is only meaningful to the CA. If the command received by the CA does not include a ``service`` parameter or this list is empty, the CA simply processes this message on its own. For example, a ``config-get`` command which includes no service -parameter returns the Control Agent's own configuration. The -``config-get`` command with a service value "dhcp4" is forwarded to the DHCPv4 -server and returns the DHCPv4 server's configuration. +parameter returns the Control Agent's own configuration. The ``config-get`` +command with a service value "dhcp4" is forwarded to the DHCPv4 server and +returns the DHCPv4 server's configuration. The following list shows the mapping of the values carried within the ``service`` parameter to the servers to which the commands are @@ -180,9 +180,9 @@ The ``text`` field typically appears when the result is non-zero and contains a description of the error encountered, but it often also appears for successful outcomes. The exact text is command-specific, but in general uses plain English to describe the outcome of the command. -``arguments`` is a map of additional data values returned by the server -which are specific to the command issued. The map may be present, but -that depends on the specific command. +The ``arguments`` map contains additional data values returned by the server +which are specific to the command issued. The map may be present, but that +depends on the specific command. .. note:: @@ -385,7 +385,7 @@ command. When ``config-reload`` is issued after ``config-set``, Kea attempts to reload its original configuration from the file, possibly losing all changes introduced using ``config-set`` or other commands. -``config-reload`` does not take any parameters. An example command +The ``config-reload`` command does not take any parameters. An example command invocation looks like this: :: diff --git a/doc/sphinx/arm/dhcp4-srv.rst b/doc/sphinx/arm/dhcp4-srv.rst index a76c691cdb..b1537eb8de 100644 --- a/doc/sphinx/arm/dhcp4-srv.rst +++ b/doc/sphinx/arm/dhcp4-srv.rst @@ -2953,10 +2953,10 @@ options and sub-options, using the respective option code. "code": 240, "name": "my-option", "csv-format": true, - "data": "data - -00010203040506070809-00010203040506070809-00010203040506070809-00010203040506070809 - -00010203040506070809-00010203040506070809-00010203040506070809-00010203040506070809 - -00010203040506070809-00010203040506070809-00010203040506070809-00010203040506070809 + "data": "data \ + -00010203040506070809-00010203040506070809-00010203040506070809-00010203040506070809 \ + -00010203040506070809-00010203040506070809-00010203040506070809-00010203040506070809 \ + -00010203040506070809-00010203040506070809-00010203040506070809-00010203040506070809 \ -data", "space": "dhcp4" } diff --git a/doc/sphinx/arm/dhcp6-srv.rst b/doc/sphinx/arm/dhcp6-srv.rst index b112e1e720..4ca0b227df 100644 --- a/doc/sphinx/arm/dhcp6-srv.rst +++ b/doc/sphinx/arm/dhcp6-srv.rst @@ -1336,7 +1336,7 @@ with the addresses 2001:db8:1::cafe and 2001:db8:1::babe. "code": 23, "space": "dhcp6", "csv-format": false, - "data": "20 01 0D B8 00 01 00 00 00 00 00 00 00 00 CA FE + "data": "20 01 0D B8 00 01 00 00 00 00 00 00 00 00 CA FE \ 20 01 0D B8 00 01 00 00 00 00 00 00 00 00 BA BE" }, ... diff --git a/tools/check-for-json-errors-in-doc.sh b/tools/check-for-json-errors-in-doc.sh index b8b460c336..b8c96a4984 100755 --- a/tools/check-for-json-errors-in-doc.sh +++ b/tools/check-for-json-errors-in-doc.sh @@ -32,11 +32,11 @@ for file in $files; do comment=0 echo "" >> $work_file continue - elif [ $comment -eq 0 -a $json -eq 0 -a $(echo "$line" | grep "^\s*{\|^\s*\".*{" | grep -v "}" | wc -l) -eq 1 ]; then + elif [ $comment -eq 0 -a $json -eq 0 -a $(echo "$line" | grep "^\s*{\|^\s*\".*{\|^\s*\[\s*$" | grep -v "}" | wc -l) -eq 1 ]; then # if this is not a comment and the line starts with spaces followed by '{' or by '"' followed by "{" json=1 # ignore any map name before top level map - line=$(echo "$line" | sed "s/.*{/{/g") + line=$(echo "$line" | sed 's/.*{/{/g') echo "" > $work_file elif [ $comment -eq 0 -a $json -eq 1 -a $(echo "$line" | grep "^\s*[A-Za-z]\|^\s*\`" | wc -l) -eq 1 ]; then # if the line is not a comment and the line starts with spaces followed by 'A-Za-z' or followed by "`" and the parser is processing a json structure @@ -66,17 +66,17 @@ for file in $files; do # 9. replace ' ' with ' "placeholder": "value"' # 10. replace ' ' with ' "placeholder"' if [ $(echo "$file" | grep "\.json" | wc -l) -eq 0 ]; then - echo "$line" | cut -d "#" -f 1 | sed "s/\/\/ .*//g" | sed "s///g" | sed "s/\[ <\([-A-Za-z0-9 ]*\)> \]/\[ \"<\1>\" \]/g" | sed "s/ <\(.*\)>:/ \"<\1>\":/g" | sed "s/: <\(.*\)>/: \"<\1>\"/g" | sed "s/ \.\.\./ \"placeholder\": \"value\"/g" | sed "s/, \.\.\. / /g" | sed "s/ <\(.*\)>/ \"placeholder\": \"value\"/g" | sed "s/ <\(.*\)>/ \"placeholder\"/g" >> $work_file + echo "$line" | cut -d "#" -f 1 | sed 's/\/\/ .*//g' | sed 's///g' | sed 's/\[ <\([-A-Za-z0-9 ]*\)> \]/\[ \"<\1>\" \]/g' | sed 's/ <\(.*\)>:/ \"<\1>\":/g' | sed 's/: <\(.*\)>/: \"<\1>\"/g' | sed 's/ \.\.\./ \"placeholder\": \"value\"/g' | sed 's/, \.\.\. / /g' | sed 's/ <\(.*\)>/ \"placeholder\": \"value\"/g' | sed 's/ <\(.*\)>/ \"placeholder\"/g' >> $work_file else # if file is .rst the following replace in line are done: # 1. delete everything after '#' # 2. delete everything after // # 3. ignore - echo "$line" | cut -d "#" -f 1 | sed "s/\/\/ .*//g" | sed "s///g" >> $work_file + echo "$line" | cut -d "#" -f 1 | sed 's/\/\/ .*//g' | sed 's///g' >> $work_file fi fi fi - done <<< $(cat $file | sed ':a;N;$!ba;s/,\s*\n\s*\.\.\.//g') + done <<< $(cat $file | sed ':a;N;$!ba;s/,\s*\n\s*\.\.\.//g' | sed ':a;N;$!ba;s/\s\\\n//g') if [ $comment -eq 0 -a $json -eq 1 ]; then # if the file ended but the parser is processing a json structure cat $work_file | jq . > /dev/null