get.porter.sh/porter@v1.3.0/tests/testdata/mybuns/helpers.sh (about)

     1  #!/usr/bin/env bash
     2  set -euo pipefail
     3  
     4  install() {
     5    touch /cnab/app/outputs/tfstate
     6    if [[ "$LOG_LEVEL" == "11" ]]; then
     7      echo Hello, "$ROOT_USERNAME"!
     8    fi
     9  }
    10  
    11  makeMagic() {
    12    echo "$1" > /cnab/app/magic.txt
    13  }
    14  
    15  ensureMagic() {
    16    if ! test -f "magic.txt"; then
    17      echo "No magic detected"
    18      exit 1
    19    fi
    20  }
    21  
    22  upgrade() {
    23    if [[ "$LOG_LEVEL" == "11" ]]; then
    24      echo World 2.0
    25    fi
    26  }
    27  
    28  uninstall() {
    29    if [[ "$LOG_LEVEL" == "11" ]]; then
    30      echo Goodbye World
    31    fi
    32  }
    33  
    34  chaos_monkey() {
    35    if [[ "$1" == "true" ]]; then
    36      echo "a chaos monkey appears. you have died"
    37      exit 1
    38    fi
    39  
    40      echo "no chaos monkey appeared. you have lived"
    41  
    42  }
    43  
    44  # Call the requested function and pass the arguments as-is
    45  "$@"