v_list_dns_template 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/bash
  2. # info: listing dns template
  3. #----------------------------------------------------------#
  4. # Variable&Function #
  5. #----------------------------------------------------------#
  6. # Argument defenition
  7. template="$1"
  8. format="${2-shell}"
  9. limit="${3-1000}"
  10. offset="${4-1}"
  11. # Importing variables
  12. source $VESTA/conf/vars.conf
  13. source $V_FUNC/shared_func.sh
  14. source $V_FUNC/domain_func.sh
  15. #----------------------------------------------------------#
  16. # Verifications #
  17. #----------------------------------------------------------#
  18. # Checking args
  19. check_args '1' "$#" 'template [format]'
  20. # Checking argument format
  21. format_validation 'template'
  22. # Checking template
  23. is_template_valid 'dns'
  24. #----------------------------------------------------------#
  25. # Action #
  26. #----------------------------------------------------------#
  27. # Defining config
  28. conf="$V_DNSTPL/$template.tpl"
  29. # Defining fileds to select
  30. fields='$RECORD $TYPE $VALUE'
  31. # Listing domains
  32. case $format in
  33. json) dns_json_list ;;
  34. shell) dns_shell_list | column -t ;;
  35. *) check_args '1' "0" 'template [format]'
  36. esac
  37. #----------------------------------------------------------#
  38. # Vesta #
  39. #----------------------------------------------------------#
  40. # Logging
  41. log_event 'system' "$V_EVENT"
  42. exit $OK