Skip to content

Commit b86f13b

Browse files
committed
Error out nicely if podman is not present
If podman is not installed we get the following unfriendly output: [michele@rhel1]~/multicloud-gitops% ./pattern.sh ./pattern.sh: line 10: podman: command not found ./pattern.sh: line 10: podman: command not found ./pattern.sh: line 32: podman: command not found Let's bail out and have a generic function to check for that in case we need to add other requirements
1 parent a4f9e6d commit b86f13b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

scripts/pattern-util.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
#!/bin/bash
2+
function is_available {
3+
command -v $1 >/dev/null 2>&1 || { echo >&2 "$1 is required but it's not installed. Aborting."; exit 1; }
4+
}
25

36
if [ -z "$PATTERN_UTILITY_CONTAINER" ]; then
47
PATTERN_UTILITY_CONTAINER="quay.io/hybridcloudpatterns/utility-container"
58
fi
69

10+
readonly commands=(podman)
11+
for cmd in ${commands[@]}; do is_available "$cmd"; done
12+
713
UNSUPPORTED_PODMAN_VERSIONS="1.6 1.5"
814
for i in ${UNSUPPORTED_PODMAN_VERSIONS}; do
915
# We add a space

0 commit comments

Comments
 (0)