github.com/juju/juju@v0.0.0-20240327075706-a90865de2538/testcharms/charms/simple-resolve/hooks/install (about) 1 #!/bin/bash 2 3 # Simple install hook that errors the first time it is run, on any subsequent 4 # run the hook will succeed (unless the canary file is removed). 5 6 canary_file=/tmp/resolver.canary 7 success_file=/tmp/resolver.success 8 9 function exit_error() { 10 status-set blocked "Install hook failed on: $1 attempts." || true 11 exit 1 12 } 13 14 if [ ! -e ${canary_file} ]; then 15 echo "No canary file, exiting error." 16 echo 1 > ${canary_file} 17 exit_error 1 18 fi 19 20 # Need to error for x amount of times before juju stops trying automatically. 21 run_count=$(cat ${canary_file}) 22 23 # For now juju is always re-trying. Need to just exit regardless. 24 echo $((${run_count}+1)) > ${canary_file} 25 exit_error ${run_count} 26