Removed excess whitespace and added validate return code

This commit is contained in:
Stephen Dendtler 2021-01-06 17:43:39 +00:00
parent 4e1c1edce8
commit 0ca150a7d9

View File

@ -114,7 +114,6 @@ _get_root() {
_rackcorp_validate() { _rackcorp_validate() {
RACKCORP_APIUUID="${RACKCORP_APIUUID:-$(_readaccountconf_mutable RACKCORP_APIUUID)}" RACKCORP_APIUUID="${RACKCORP_APIUUID:-$(_readaccountconf_mutable RACKCORP_APIUUID)}"
if [ -z "$RACKCORP_APIUUID" ]; then if [ -z "$RACKCORP_APIUUID" ]; then
RACKCORP_APIUUID="" RACKCORP_APIUUID=""
_err "You require a RackCorp API UUID (export RACKCORP_APIUUID=\"<api uuid>\")" _err "You require a RackCorp API UUID (export RACKCORP_APIUUID=\"<api uuid>\")"
@ -124,10 +123,7 @@ _rackcorp_validate() {
_saveaccountconf_mutable RACKCORP_APIUUID "$RACKCORP_APIUUID" _saveaccountconf_mutable RACKCORP_APIUUID "$RACKCORP_APIUUID"
RACKCORP_APISECRET="${RACKCORP_APISECRET:-$(_readaccountconf_mutable RACKCORP_APISECRET)}" RACKCORP_APISECRET="${RACKCORP_APISECRET:-$(_readaccountconf_mutable RACKCORP_APISECRET)}"
if [ -z "$RACKCORP_APISECRET" ]; then if [ -z "$RACKCORP_APISECRET" ]; then
RACKCORP_APISECRET="" RACKCORP_APISECRET=""
_err "You require a RackCorp API secret (export RACKCORP_APISECRET=\"<api secret>\")" _err "You require a RackCorp API secret (export RACKCORP_APISECRET=\"<api secret>\")"
@ -135,9 +131,9 @@ _rackcorp_validate() {
return 1 return 1
fi fi
#save the api key to the account conf file.
_saveaccountconf_mutable RACKCORP_APISECRET "$RACKCORP_APISECRET" _saveaccountconf_mutable RACKCORP_APISECRET "$RACKCORP_APISECRET"
return 0
} }
_rackcorp_api() { _rackcorp_api() {
_rackcorpcmd=$1 _rackcorpcmd=$1