Verified Commit 17038334 authored by Xueshan Feng's avatar Xueshan Feng
Browse files

change vault write to vault kv put.

parent 7355d105
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ rand=/tmp/duo-$RANDOM
# Check if the duo key already exist in vault
# VENDOR_ACCOUNT is something to identify which account this duo key is used
# e.g. anchorage.
if vault read secret/global/${VENDOR_ACCOUNT}/vault/${PROVISION_ENV}/duo/ikey ; then
if vault kv get secret/global/${VENDOR_ACCOUNT}/vault/${PROVISION_ENV}/duo/ikey ; then
  echo "Duo key for $node already exists at secret/global/${VENDOR_ACCOUNT}/vault/dev/duo/ikey."
  echo "Skipping create duo key."
  exit 0
@@ -39,9 +39,9 @@ echo ""
ssh $USER@${remote_server} ~$USER/create-duo.sh $node $template > $rand
		
if grep -q ikey $rand ; then
  vault write secret/global/${VENDOR_ACCOUNT}/vault/${PROVISION_ENV}/duo/ikey format=text value=`grep ikey $rand | cut -d ' ' -f3`
  vault write secret/global/${VENDOR_ACCOUNT}/vault/${PROVISION_ENV}/duo/skey format=text value=`grep skey $rand | cut -d ' ' -f3`
  vault write secret/global/${VENDOR_ACCOUNT}/vault/${PROVISION_ENV}/duo/host format=text value=`grep host $rand | cut -d ' ' -f3`
  vault kv put secret/global/${VENDOR_ACCOUNT}/vault/${PROVISION_ENV}/duo/ikey format=text value=`grep ikey $rand | cut -d ' ' -f3`
  vault kv put secret/global/${VENDOR_ACCOUNT}/vault/${PROVISION_ENV}/duo/skey format=text value=`grep skey $rand | cut -d ' ' -f3`
  vault kv put secret/global/${VENDOR_ACCOUNT}/vault/${PROVISION_ENV}/duo/host format=text value=`grep host $rand | cut -d ' ' -f3`
	rm -rf $rand
else
  echo "No duo keys found in $rand."