diff options
author | Thomas Haller <thaller@redhat.com> | 2023-11-21 14:22:54 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2023-11-22 12:15:54 +0100 |
commit | 485efcd3df69999d713031433d862147eba15cde (patch) | |
tree | bec7f837b12e5e508871d3e34f2474b6757ffb60 /tests/shell/helpers/json-sanitize-ruleset.sh | |
parent | cb2c37ca3adb7809035ec4ff5d01ffa532839875 (diff) |
tests/shell: sanitize "handle" in JSON output
The "handle" in JSON output is not stable. Sanitize/normalize to zero.
Adjust the sanitize code, and regenerate the .json-nft files.
Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/shell/helpers/json-sanitize-ruleset.sh')
-rwxr-xr-x | tests/shell/helpers/json-sanitize-ruleset.sh | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/shell/helpers/json-sanitize-ruleset.sh b/tests/shell/helpers/json-sanitize-ruleset.sh index 270a6107..31b85cbd 100755 --- a/tests/shell/helpers/json-sanitize-ruleset.sh +++ b/tests/shell/helpers/json-sanitize-ruleset.sh @@ -6,7 +6,14 @@ die() { } do_sed() { - sed '1s/\({"nftables": \[{"metainfo": {"version": "\)[0-9.]\+\(", "release_name": "\)[^"]\+\(", "\)/\1VERSION\2RELEASE_NAME\3/' "$@" + # Normalize the "version"/"release_name", otherwise we have to + # regenerate the JSON output upon new release. + # + # Also, "handle" are not stable. Normalize them 0. + sed \ + -e '1s/^\({"nftables": \[{"metainfo": {"version": "\)[0-9.]\+\(", "release_name": "\)[^"]\+\(", "\)/\1VERSION\2RELEASE_NAME\3/' \ + -e '1s/"handle": [0-9]\+\>/"handle": 0/g' \ + "$@" } if [ "$#" = 0 ] ; then |