From a9e0a77f45e57be60e163b66e1c2fb17896ae7eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Sat, 18 May 2024 02:16:27 +0300 Subject: [PATCH] Code Update --- init.sh | 24 ++++++++++++------------ src/functions/init.sh | 4 ++-- src/functions/login.sh | 20 ++++++++++---------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/init.sh b/init.sh index c21bbc5..6dde261 100755 --- a/init.sh +++ b/init.sh @@ -58,11 +58,11 @@ wi-init(){ GIT_DOMAIN="git.cwinfo.net" GIT_PORT="2222" - GIT_REPOSITORY="infra-plus" + GIT_REPOSITORY="warengroup/infra-plus" ssh-keyscan -p $GIT_PORT $GIT_DOMAIN &> ~/.ssh/known_hosts - export HVT = ${config["login",$ORG]} + export HVT=${config["login",$ORG]} /opt/ansible/bin/ansible-pull -U ssh://git@$GIT_DOMAIN:$GIT_PORT/$GIT_REPOSITORY --vault-password-file ~/.ansible/vault.yml --private-key ~/.ssh/init playbooks/init.yml -t init @@ -77,7 +77,7 @@ wi-login(){ echo " >> Login << " echo "------------------------------" - echo -n "Status: Hostname Required" + echo "Status: Hostname Required" wi-stop fi @@ -97,7 +97,7 @@ wi-login(){ echo " >> Login << " echo "------------------------------" - echo -n "Status: Organization Required" + echo "Status: Organization Required" wi-stop fi @@ -114,7 +114,7 @@ wi-login(){ echo " >> Login << " echo "------------------------------" - echo -n "Status: Organization Unsupported" + echo "Status: Organization Unsupported" wi-stop fi @@ -133,7 +133,7 @@ wi-login(){ echo " >> Login << " echo "------------------------------" - echo -n "Status: Hostname Required" + echo "Status: Hostname Required" wi-stop fi @@ -146,7 +146,7 @@ wi-login(){ echo " >> Login << " echo "------------------------------" - echo -n "Status: Username Required" + echo "Status: Username Required" wi-stop else USER=$LOGNAME @@ -183,13 +183,13 @@ wi-login(){ if [[ -z $USERNAME || -z $PASSWORD ]] then - echo -n "Status: Username & Password Required" + echo "Status: Username & Password Required" wi-stop else VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/ldap/login/$USERNAME -X POST -d '{ "password": "'$PASSWORD'" }' -s | jq -r '.auth.client_token') if [[ -z $VAULT_LOGIN || ${#VAULT_LOGIN} -lt 95 || ${#VAULT_LOGIN} -gt 95 ]] then - echo -n "Status: Login Failed" + echo "Status: Login Failed" wi-stop fi @@ -208,14 +208,14 @@ wi-login(){ if [[ -z $TOKEN || ${#TOKEN} -lt 95 || ${#TOKEN} -gt 95 ]] then - echo -n "Status: Vault Token Required" + echo "Status: Vault Token Required" wi-stop fi VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/token/renew -X POST --header "X-Vault-Token: $TOKEN" -d '{ "token": "'$TOKEN'" }' -s | jq -r '.auth.client_token') if [[ -z $VAULT_LOGIN || ${#VAULT_LOGIN} -lt 95 || ${#VAULT_LOGIN} -gt 95 ]] then - echo -n "Status: Login Failed" + echo "Status: Login Failed" wi-stop fi @@ -228,7 +228,7 @@ wi-login(){ echo $wiBold$ORG$wiNormal - echo -n "Status: Vault Offline" + echo "Status: Vault Offline" wi-stop fi } diff --git a/src/functions/init.sh b/src/functions/init.sh index d99f082..7877da5 100644 --- a/src/functions/init.sh +++ b/src/functions/init.sh @@ -39,11 +39,11 @@ wi-init(){ GIT_DOMAIN="git.cwinfo.net" GIT_PORT="2222" - GIT_REPOSITORY="infra-plus" + GIT_REPOSITORY="warengroup/infra-plus" ssh-keyscan -p $GIT_PORT $GIT_DOMAIN &> ~/.ssh/known_hosts - export HVT = ${config["login",$ORG]} + export HVT=${config["login",$ORG]} /opt/ansible/bin/ansible-pull -U ssh://git@$GIT_DOMAIN:$GIT_PORT/$GIT_REPOSITORY --vault-password-file ~/.ansible/vault.yml --private-key ~/.ssh/init playbooks/init.yml -t init diff --git a/src/functions/login.sh b/src/functions/login.sh index 1592985..c228563 100644 --- a/src/functions/login.sh +++ b/src/functions/login.sh @@ -6,7 +6,7 @@ wi-login(){ echo " >> Login << " echo "------------------------------" - echo -n "Status: Hostname Required" + echo "Status: Hostname Required" wi-stop fi @@ -26,7 +26,7 @@ wi-login(){ echo " >> Login << " echo "------------------------------" - echo -n "Status: Organization Required" + echo "Status: Organization Required" wi-stop fi @@ -43,7 +43,7 @@ wi-login(){ echo " >> Login << " echo "------------------------------" - echo -n "Status: Organization Unsupported" + echo "Status: Organization Unsupported" wi-stop fi @@ -62,7 +62,7 @@ wi-login(){ echo " >> Login << " echo "------------------------------" - echo -n "Status: Hostname Required" + echo "Status: Hostname Required" wi-stop fi @@ -75,7 +75,7 @@ wi-login(){ echo " >> Login << " echo "------------------------------" - echo -n "Status: Username Required" + echo "Status: Username Required" wi-stop else USER=$LOGNAME @@ -112,13 +112,13 @@ wi-login(){ if [[ -z $USERNAME || -z $PASSWORD ]] then - echo -n "Status: Username & Password Required" + echo "Status: Username & Password Required" wi-stop else VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/ldap/login/$USERNAME -X POST -d '{ "password": "'$PASSWORD'" }' -s | jq -r '.auth.client_token') if [[ -z $VAULT_LOGIN || ${#VAULT_LOGIN} -lt 95 || ${#VAULT_LOGIN} -gt 95 ]] then - echo -n "Status: Login Failed" + echo "Status: Login Failed" wi-stop fi @@ -137,14 +137,14 @@ wi-login(){ if [[ -z $TOKEN || ${#TOKEN} -lt 95 || ${#TOKEN} -gt 95 ]] then - echo -n "Status: Vault Token Required" + echo "Status: Vault Token Required" wi-stop fi VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/token/renew -X POST --header "X-Vault-Token: $TOKEN" -d '{ "token": "'$TOKEN'" }' -s | jq -r '.auth.client_token') if [[ -z $VAULT_LOGIN || ${#VAULT_LOGIN} -lt 95 || ${#VAULT_LOGIN} -gt 95 ]] then - echo -n "Status: Login Failed" + echo "Status: Login Failed" wi-stop fi @@ -157,7 +157,7 @@ wi-login(){ echo $wiBold$ORG$wiNormal - echo -n "Status: Vault Offline" + echo "Status: Vault Offline" wi-stop fi }