Require validation and import only for push/pull

This commit is contained in:
Michael Stanclift 2020-05-22 10:55:23 -05:00
parent eacefeeaa7
commit 2c8e00a0d8

View File

@ -138,7 +138,7 @@ function validate_ph_folders {
function validate_gs_arguments { function validate_gs_arguments {
echo "Usage: $0 {pull|push}" echo "Usage: $0 {pull|push}"
echo -e "> ${YELLOW}Pull${NC} will copy the ${GRAVITY_FI} configuration on $REMOTE_HOST to this server" echo -e "> ${YELLOW}Pull${NC} will copy the ${GRAVITY_FI} configuration on a remote host to this server"
echo -e "> ${YELLOW}Push${NC} will force any changes made on this server to the primary" echo -e "> ${YELLOW}Push${NC} will force any changes made on this server to the primary"
echo -e "No changes have been made to the system" echo -e "No changes have been made to the system"
exit 1 exit 1
@ -146,12 +146,6 @@ function validate_gs_arguments {
# SCRIPT EXECUTION ########################### # SCRIPT EXECUTION ###########################
import_gs
echo -e "${CYAN}Validating sync folder configuration${NC}"
validate_gs_folders
validate_ph_folders
echo -e "${CYAN}Evaluating $0 script arguments${NC}" echo -e "${CYAN}Evaluating $0 script arguments${NC}"
case $# in case $# in
@ -165,13 +159,25 @@ case $# in
case $1 in case $1 in
pull) pull)
echo -e "${GREEN}Success${NC}: Pull Requested" echo -e "${GREEN}Success${NC}: Pull Requested"
pull_gs import_gs
echo -e "${CYAN}Validating sync folder configuration${NC}"
validate_gs_folders
validate_ph_folders
pull_gs
exit exit
;; ;;
push) push)
echo -e "${GREEN}Success${NC}: Push Requested" echo -e "${GREEN}Success${NC}: Push Requested"
push_gs import_gs
echo -e "${CYAN}Validating sync folder configuration${NC}"
validate_gs_folders
validate_ph_folders
push_gs
exit exit
;; ;;