Skip to content

Commit

Permalink
shellcheck and expect TK_HOME to be set already
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscunningham-qodea committed May 13, 2021
1 parent a7abad8 commit 30def6c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ serialised in a manner that permits them to be loaded as inputs to Inspec.

## Usage

Ensure that the `TK_HOME` environment variable is set to the directory that
contains the Test Kitchen config.

## Configuration

The tool expects the following directory structure:

```none
Expand Down
15 changes: 10 additions & 5 deletions tg-wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
set -e
# export TERRAGRUNT_SOURCE_UPDATE=true to track a branch rather than a tag
export TF_INPUT=false
TK_HOME="$(dirname $(readlink -f $0))"
trap "mv $TK_HOME/environments/root.yaml.bak $TK_HOME/environments/root.yaml" EXIT
# expect TK_HOME to be set
if [ -z ${TK_HOME+x} ]; then
echo "TK_HOME is unset"
exit 1
fi
trap 'mv $TK_HOME/environments/root.yaml.bak $TK_HOME/environments/root.yaml' EXIT

export GOOGLE_OAUTH_ACCESS_TOKEN=$(create-token -d $TK_HOME/test/integration)
mv $TK_HOME/environments/root.yaml $TK_HOME/environments/root.yaml.bak
cp $TK_HOME/test/integration/root.yaml $TK_HOME/environments/root.yaml
GOOGLE_OAUTH_ACCESS_TOKEN=$(create-token -d "$TK_HOME/test/integration")
export GOOGLE_OAUTH_ACCESS_TOKEN
mv "$TK_HOME/environments/root.yaml" "$TK_HOME/environments/root.yaml.bak"
cp "$TK_HOME/test/integration/root.yaml" "$TK_HOME/environments/root.yaml"

case $1 in
"apply")
Expand Down

0 comments on commit 30def6c

Please sign in to comment.