You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
755 B

  1. #!/bin/bash
  2. ## Should be executable N time in a row with same result.
  3. set -e
  4. VOLUMES=$(relation-get volumes 2>/dev/null)
  5. GROUP=$(relation-get group 2>/dev/null) || true
  6. if test "$GROUP" && ! getent group "$GROUP" >/dev/null 2>&1; then
  7. die "No group '$GROUP' found."
  8. fi
  9. config-add "\
  10. $MASTER_TARGET_SERVICE_NAME:
  11. volumes:
  12. $(while read-0 volume_def; do
  13. IFS=: read src dst mode < <(echo "$volume_def:")
  14. mode=${mode:-rw}
  15. if [ "$mode" == "rw" -a "$GROUP" ]; then
  16. debug setfacl -m "g:$GROUP:rwx" -R "$DATASTORE/$BASE_SERVICE_NAME$src"
  17. setfacl -m "g:$GROUP:rwx" -R "$DATASTORE/$BASE_SERVICE_NAME$src"
  18. fi
  19. echo " - $DATASTORE/$BASE_SERVICE_NAME$src:$dst:$mode"
  20. done < <(echo "$VOLUMES" | shyaml get-values-0))"