1
0
mirror of https://github.com/openshift/installer.git synced 2026-02-06 00:48:45 +01:00

hack/tf-fmt: Allow callers to pass positional args

This way they can use:

  $ hack/tf-fmt.sh -list -check

to update their local Terraform (vs. just checking if it's correctly
formatted).  I've also dropped the read-only mount option to support
this use case.

I use set [1] to inject default args if the caller set no positional
args themselves [2], so the test config in openshift/release continues
to work.

[1]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#set
[2]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_05_02
This commit is contained in:
W. Trevor King
2018-09-13 11:00:27 -07:00
parent ef594e5016
commit 4b9cbdd995

View File

@@ -2,12 +2,15 @@
# in prow, already in container, so no 'podman run'
if [ "$IS_CONTAINER" != "" ]; then
if [ "${#N}" -gt 1 ]; then
set -- -list -check -write=false
fi
set -x
/terraform fmt -list -check -write=false
/terraform fmt "${@}"
else
podman run --rm \
--env IS_CONTAINER=TRUE \
--volume "${PWD}:${PWD}:ro,z" \
--volume "${PWD}:${PWD}:z" \
--workdir "${PWD}" \
quay.io/coreos/terraform-alpine:v0.11.7 \
./hack/tf-fmt.sh