Skip to content
Snippets Groups Projects
Commit 6275eb8e authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

check required jq

parent 82d0b513
No related branches found
No related tags found
No related merge requests found
...@@ -6,9 +6,10 @@ ...@@ -6,9 +6,10 @@
# #
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# 2022-09-14 v1.0 <axel.hahn@iml.unibe.ch> initial version # 2022-09-14 v1.0 <axel.hahn@iml.unibe.ch> initial version
# 2022-09-15 v1.1 <axel.hahn@iml.unibe.ch> check required jq
# ====================================================================== # ======================================================================
_version="1.0" _version="1.1"
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# HELP # HELP
...@@ -22,6 +23,7 @@ Search for hostnames in Infoblox API and show all hosts that have an ...@@ -22,6 +23,7 @@ Search for hostnames in Infoblox API and show all hosts that have an
activated custom ttl value. activated custom ttl value.
It uses dns-api.sh and adds the return field for aliases. It uses dns-api.sh and adds the return field for aliases.
The filter functionality of json data requires jq.
SYNTAX: dns-search.sh REGEX SYNTAX: dns-search.sh REGEX
...@@ -41,5 +43,10 @@ mysearch=$1 ...@@ -41,5 +43,10 @@ mysearch=$1
>&2 echo ";" >&2 echo ";"
>&2 echo "; >>>>>>>>>> INFOBLOX DNS HELPER TTL v$_version" >&2 echo "; >>>>>>>>>> INFOBLOX DNS HELPER TTL v$_version"
>&2 echo ";" >&2 echo ";"
which jq >/dev/null || exit
"$( dirname $0 )"/dns-api.sh GET "/record:host?name~=${mysearch}&_return_fields%2B=ttl,use_ttl" \ "$( dirname $0 )"/dns-api.sh GET "/record:host?name~=${mysearch}&_return_fields%2B=ttl,use_ttl" \
| jq -r '.[] | select ( .use_ttl == true and .ttl != null ) | .name,.ttl' | jq -r '.[] | select ( .use_ttl == true and .ttl != null ) | .name,.ttl'
# ----------------------------------------------------------------------
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment