Source Update
This commit is contained in:
parent
56b6f58f4e
commit
ee152b0562
@ -5,7 +5,6 @@ if [ ! "$BASH_VERSION" ] ; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
{{ ELEMENTS }}
|
|
||||||
{{ FUNCTIONS }}
|
{{ FUNCTIONS }}
|
||||||
{{ COMMANDS }}
|
{{ COMMANDS }}
|
||||||
|
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
wx-elements-line-douple () {
|
|
||||||
echo "=============================="
|
|
||||||
}
|
|
||||||
wx-elements-line-single () {
|
|
||||||
echo "------------------------------"
|
|
||||||
}
|
|
@ -3,7 +3,7 @@ wx-login() {
|
|||||||
ORG=$2
|
ORG=$2
|
||||||
|
|
||||||
if [[ -z "$HOSTNAME" || ${#HOSTNAME} -lt 5 ]]; then
|
if [[ -z "$HOSTNAME" || ${#HOSTNAME} -lt 5 ]]; then
|
||||||
stop
|
wx-stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $(hostname -d) == "devices.waren.io" ]]
|
if [[ $(hostname -d) == "devices.waren.io" ]]
|
||||||
@ -18,7 +18,7 @@ wx-login() {
|
|||||||
elif [[ -z $ORG ]]
|
elif [[ -z $ORG ]]
|
||||||
then
|
then
|
||||||
echo "Organization: Required"
|
echo "Organization: Required"
|
||||||
stop
|
wx-stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $ORG == "warengroup" ]]
|
if [[ $ORG == "warengroup" ]]
|
||||||
@ -32,7 +32,7 @@ wx-login() {
|
|||||||
DOMAIN=christerwaren.fi
|
DOMAIN=christerwaren.fi
|
||||||
else
|
else
|
||||||
echo "Organization: Unsupported"
|
echo "Organization: Unsupported"
|
||||||
stop
|
wx-stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
FOLDER=$ORG
|
FOLDER=$ORG
|
||||||
@ -49,7 +49,7 @@ wx-login() {
|
|||||||
HOSTNAME="$2.$DEVICE_DOMAIN"
|
HOSTNAME="$2.$DEVICE_DOMAIN"
|
||||||
else
|
else
|
||||||
echo "Hostname: Required"
|
echo "Hostname: Required"
|
||||||
stop
|
wx-stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z $USER ]]
|
if [[ -z $USER ]]
|
||||||
@ -59,7 +59,7 @@ wx-login() {
|
|||||||
if [[ -z LOGNAME ]]
|
if [[ -z LOGNAME ]]
|
||||||
then
|
then
|
||||||
echo "Username: Required"
|
echo "Username: Required"
|
||||||
stop
|
wx-stop
|
||||||
else
|
else
|
||||||
USER=$LOGNAME
|
USER=$LOGNAME
|
||||||
fi
|
fi
|
||||||
@ -90,18 +90,18 @@ wx-login() {
|
|||||||
VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/ldap/login/$USERNAME -X POST -d '{ "password": "'$PASSWORD'" }' -s | jq -r '.auth.client_token')
|
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
|
if [[ -z $VAULT_LOGIN || ${#VAULT_LOGIN} -lt 95 || ${#VAULT_LOGIN} -gt 95 ]]; then
|
||||||
echo "Status: Login Failed"
|
echo "Status: Login Failed"
|
||||||
stop
|
wx-stop
|
||||||
fi
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
else
|
else
|
||||||
echo "Organization: $ORG"
|
echo "Organization: $ORG"
|
||||||
echo "Status: IDM Offline"
|
echo "Status: IDM Offline"
|
||||||
stop
|
wx-stop
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Organization: $ORG"
|
echo "Organization: $ORG"
|
||||||
echo "Status: Vault Offline"
|
echo "Status: Vault Offline"
|
||||||
stop
|
wx-stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ wx-login() {
|
|||||||
# VAULT_LOGIN=$(vault login -address=https://vault.$DOMAIN -method=ldap username=$USER 2> /dev/null)
|
# VAULT_LOGIN=$(vault login -address=https://vault.$DOMAIN -method=ldap username=$USER 2> /dev/null)
|
||||||
# echo ""
|
# echo ""
|
||||||
# if [[ -z $VAULT_LOGIN ]]; then
|
# if [[ -z $VAULT_LOGIN ]]; then
|
||||||
stop
|
# wx-stop
|
||||||
# fi
|
# fi
|
||||||
# else
|
# else
|
||||||
# echo "vault.$DOMAIN - Login"
|
# echo "vault.$DOMAIN - Login"
|
||||||
@ -129,7 +129,7 @@ wx-login() {
|
|||||||
# VAULT_LOGIN=$(vault login -address=https://vault.$DOMAIN -method=token 2> /dev/null)
|
# VAULT_LOGIN=$(vault login -address=https://vault.$DOMAIN -method=token 2> /dev/null)
|
||||||
# echo ""
|
# echo ""
|
||||||
# if [[ -z $VAULT_LOGIN || ${#VAULT_TOKEN} -lt 95 || ${#VAULT_TOKEN} -gt 95 ]]; then
|
# if [[ -z $VAULT_LOGIN || ${#VAULT_TOKEN} -lt 95 || ${#VAULT_TOKEN} -gt 95 ]]; then
|
||||||
# stop
|
# wx-stop
|
||||||
# fi
|
# fi
|
||||||
# fi
|
# fi
|
||||||
# fi
|
# fi
|
||||||
|
@ -2,7 +2,7 @@ wx-start() {
|
|||||||
echo ""
|
echo ""
|
||||||
echo ""
|
echo ""
|
||||||
echo ""
|
echo ""
|
||||||
wx-elements-line-douple
|
echo "=============================="
|
||||||
echo "Warén CLI"
|
echo "Warén CLI"
|
||||||
wx-elements-line-douple
|
echo "=============================="
|
||||||
}
|
}
|
||||||
|
31
wx
31
wx
@ -5,19 +5,12 @@ if [ ! "$BASH_VERSION" ] ; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
wx-elements-line-douple () {
|
|
||||||
echo "=============================="
|
|
||||||
}
|
|
||||||
wx-elements-line-single () {
|
|
||||||
echo "------------------------------"
|
|
||||||
}
|
|
||||||
|
|
||||||
wx-login() {
|
wx-login() {
|
||||||
echo ">>> Login <<<"
|
echo ">>> Login <<<"
|
||||||
ORG=$2
|
ORG=$2
|
||||||
|
|
||||||
if [[ -z "$HOSTNAME" || ${#HOSTNAME} -lt 5 ]]; then
|
if [[ -z "$HOSTNAME" || ${#HOSTNAME} -lt 5 ]]; then
|
||||||
stop
|
wx-stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $(hostname -d) == "devices.waren.io" ]]
|
if [[ $(hostname -d) == "devices.waren.io" ]]
|
||||||
@ -32,7 +25,7 @@ wx-login() {
|
|||||||
elif [[ -z $ORG ]]
|
elif [[ -z $ORG ]]
|
||||||
then
|
then
|
||||||
echo "Organization: Required"
|
echo "Organization: Required"
|
||||||
stop
|
wx-stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $ORG == "warengroup" ]]
|
if [[ $ORG == "warengroup" ]]
|
||||||
@ -46,7 +39,7 @@ wx-login() {
|
|||||||
DOMAIN=christerwaren.fi
|
DOMAIN=christerwaren.fi
|
||||||
else
|
else
|
||||||
echo "Organization: Unsupported"
|
echo "Organization: Unsupported"
|
||||||
stop
|
wx-stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
FOLDER=$ORG
|
FOLDER=$ORG
|
||||||
@ -63,7 +56,7 @@ wx-login() {
|
|||||||
HOSTNAME="$2.$DEVICE_DOMAIN"
|
HOSTNAME="$2.$DEVICE_DOMAIN"
|
||||||
else
|
else
|
||||||
echo "Hostname: Required"
|
echo "Hostname: Required"
|
||||||
stop
|
wx-stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z $USER ]]
|
if [[ -z $USER ]]
|
||||||
@ -73,7 +66,7 @@ wx-login() {
|
|||||||
if [[ -z LOGNAME ]]
|
if [[ -z LOGNAME ]]
|
||||||
then
|
then
|
||||||
echo "Username: Required"
|
echo "Username: Required"
|
||||||
stop
|
wx-stop
|
||||||
else
|
else
|
||||||
USER=$LOGNAME
|
USER=$LOGNAME
|
||||||
fi
|
fi
|
||||||
@ -104,18 +97,18 @@ wx-login() {
|
|||||||
VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/ldap/login/$USERNAME -X POST -d '{ "password": "'$PASSWORD'" }' -s | jq -r '.auth.client_token')
|
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
|
if [[ -z $VAULT_LOGIN || ${#VAULT_LOGIN} -lt 95 || ${#VAULT_LOGIN} -gt 95 ]]; then
|
||||||
echo "Status: Login Failed"
|
echo "Status: Login Failed"
|
||||||
stop
|
wx-stop
|
||||||
fi
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
else
|
else
|
||||||
echo "Organization: $ORG"
|
echo "Organization: $ORG"
|
||||||
echo "Status: IDM Offline"
|
echo "Status: IDM Offline"
|
||||||
stop
|
wx-stop
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Organization: $ORG"
|
echo "Organization: $ORG"
|
||||||
echo "Status: Vault Offline"
|
echo "Status: Vault Offline"
|
||||||
stop
|
wx-stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -134,7 +127,7 @@ wx-login() {
|
|||||||
# VAULT_LOGIN=$(vault login -address=https://vault.$DOMAIN -method=ldap username=$USER 2> /dev/null)
|
# VAULT_LOGIN=$(vault login -address=https://vault.$DOMAIN -method=ldap username=$USER 2> /dev/null)
|
||||||
# echo ""
|
# echo ""
|
||||||
# if [[ -z $VAULT_LOGIN ]]; then
|
# if [[ -z $VAULT_LOGIN ]]; then
|
||||||
stop
|
# wx-stop
|
||||||
# fi
|
# fi
|
||||||
# else
|
# else
|
||||||
# echo "vault.$DOMAIN - Login"
|
# echo "vault.$DOMAIN - Login"
|
||||||
@ -143,7 +136,7 @@ wx-login() {
|
|||||||
# VAULT_LOGIN=$(vault login -address=https://vault.$DOMAIN -method=token 2> /dev/null)
|
# VAULT_LOGIN=$(vault login -address=https://vault.$DOMAIN -method=token 2> /dev/null)
|
||||||
# echo ""
|
# echo ""
|
||||||
# if [[ -z $VAULT_LOGIN || ${#VAULT_TOKEN} -lt 95 || ${#VAULT_TOKEN} -gt 95 ]]; then
|
# if [[ -z $VAULT_LOGIN || ${#VAULT_TOKEN} -lt 95 || ${#VAULT_TOKEN} -gt 95 ]]; then
|
||||||
# stop
|
# wx-stop
|
||||||
# fi
|
# fi
|
||||||
# fi
|
# fi
|
||||||
# fi
|
# fi
|
||||||
@ -160,9 +153,9 @@ wx-start() {
|
|||||||
echo ""
|
echo ""
|
||||||
echo ""
|
echo ""
|
||||||
echo ""
|
echo ""
|
||||||
wx-elements-line-douple
|
echo "=============================="
|
||||||
echo "Warén CLI"
|
echo "Warén CLI"
|
||||||
wx-elements-line-douple
|
echo "=============================="
|
||||||
}
|
}
|
||||||
|
|
||||||
wx-stop () {
|
wx-stop () {
|
||||||
|
Loading…
Reference in New Issue
Block a user