Nelze vybrat více než 25 témat
Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
|
- #!/bin/bash
-
- POSITIONAL=()
- while [[ $# -gt 0 ]]
- do
- key="$1"
-
- case $key in
- -c|--certpath)
- CERTPATH="$2"
- shift # past argument
- shift # past value
- ;;
- -n|--nebulacertbinpath)
- NEBULACERTBINPATH="$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=$(${NEBULACERTBINPATH} print -path ${CERTPATH} -json | jq -s .[].details.name | sed 's/["]//g')
- NODEIPS=$(${NEBULACERTBINPATH} print -path ${CERTPATH} -json | jq -s --compact-output .[].details.ips | sed 's/[]["]//g')
- NODEGROUPS=($(${NEBULACERTBINPATH} print -path ${CERTPATH} -json | jq -s --compact-output .[].details.groups | sed 's/[]["]//g' | sed 's/,/ /g'))
- CERTISCASTATUS=$(${NEBULACERTBINPATH} print -path ${CERTPATH} -json | jq -s --compact-output .[].details.isCa)
-
- if [[ $CERTISCASTATUS == true ]]; then
- echo "Certificate is the root CA Certificate. Try again with a node certificate."
- exit
- fi
-
- if [[ $CERTISCASTATUS == false ]]; then
- echo "Node Name: ${NODENAME}"
- echo "Node IPs: ${NODEIPS}"
- echo "Node Groups: ${NODEGROUPS[@]}"
- echo "Certificate isCa Status: ${CERTISCASTATUS}"
- fi
|