]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2822] fixed check tool and documentation
authorRazvan Becheriu <razvan@isc.org>
Fri, 12 May 2023 11:30:47 +0000 (14:30 +0300)
committerAndrei Pavel <andrei@isc.org>
Sat, 13 May 2023 13:41:20 +0000 (16:41 +0300)
doc/sphinx/arm/ctrl-channel.rst
doc/sphinx/arm/dhcp4-srv.rst
doc/sphinx/arm/dhcp6-srv.rst
tools/check-for-json-errors-in-doc.sh

index e53943b96fbfc4131afb3335ad10b52648107793..e9a6b971c0ef9abf61c9a48a7270dea0795186cd 100644 (file)
@@ -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:
 
 ::
index a76c691cdb06df790372f97777b06a728c2892f1..b1537eb8de46015fe0be8e4e47c5f3fe3f917a2f 100644 (file)
@@ -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"
                        }
index b112e1e720b525e0ed52378efbdcbaa33c145a38..4ca0b227df240bebd8da2be6f4887fbe7c1aa7c3 100644 (file)
@@ -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"
            },
            ...
index b8b460c3361a6010d752c0bde8e0f677ab06d1fa..b8c96a498480fa685a141a9de23712dbf901abf5 100755 (executable)
@@ -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 '   <DATA>' with '   "placeholder": "value"'
                                        # 10. replace ' <DATA>' 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 <?include?>
-                                       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