mirror of
https://github.com/gravitl/netmaker.git
synced 2024-11-14 05:40:50 +08:00
get token if exists already
This commit is contained in:
parent
883902d91e
commit
f467dda773
1 changed files with 13 additions and 8 deletions
|
@ -747,7 +747,11 @@ setup_mesh() {
|
|||
fi
|
||||
|
||||
echo "Obtaining a netmaker enrollment key..."
|
||||
|
||||
local netmakerTag=$(nmctl enrollment_key list | jq '.[] | .tags[0]')
|
||||
if [ "$netmakerTag" = "netmaker" ]; then
|
||||
# key exists already, fetch token
|
||||
TOKEN=$(nmctl enrollment_key list | jq '.[] | select(.tags[0]=="netmaker") | .token')
|
||||
else
|
||||
local tokenJson=$(nmctl enrollment_key create --tags netmaker --unlimited --networks netmaker)
|
||||
TOKEN=$(jq -r '.token' <<<${tokenJson})
|
||||
if test -z "$TOKEN"; then
|
||||
|
@ -756,6 +760,7 @@ setup_mesh() {
|
|||
else
|
||||
echo "Enrollment key ready"
|
||||
fi
|
||||
fi
|
||||
|
||||
wait_seconds 3
|
||||
|
||||
|
|
Loading…
Reference in a new issue