From 00635737ff166b4dbeb3d5b94dc0ad9e7f131955 Mon Sep 17 00:00:00 2001 From: hms Date: Wed, 3 Feb 2021 13:52:05 -0800 Subject: [PATCH] test code for pulling cert info with jq --- update-NebulaNodeCert | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 update-NebulaNodeCert diff --git a/update-NebulaNodeCert b/update-NebulaNodeCert new file mode 100644 index 0000000..824a356 --- /dev/null +++ b/update-NebulaNodeCert @@ -0,0 +1,40 @@ +#!/bin/bash + +POSITIONAL=() +while [[ $# -gt 0 ]] +do +key="$1" + +case $key in + -c|--certpath) + CERTPATH="$2" + shift # past argument + shift # past value + ;; + -n|--newcertname) + NEWCERTNAME="$2" + shift # past argument + shift # past value + ;; + *) # unknown option + POSITIONAL+=("$1") # save it in an array for later + shift # past argument + ;; +esac +done +set -- "${POSITIONAL[@]}" # restore positional parameters + +#if [[ -n $1 ]]; then +# echo "Invalid Parameter(s) Entered: $1" +# exit +#fi + +#if [[ -n ${IPADDRESS} ]]; then +# echo "IP Address = ${IPADDRESS}" +#fi + +NODENAME = ./nebula-cert print -path ${CERTPATH} -json | jq -s .[].details.name +NODEIPS = ./nebula-cert print -path ${CERTPATH} -json | jq -s .[].details.ips + +echo "Node Name: ${NODENAME}" +echo "Node IPs: ${NODEIPS}" \ No newline at end of file