-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce684b3
commit 885134a
Showing
3 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
checkPlaybookSyntax() | ||
{ | ||
PLAYBOOK_FILE=$1 | ||
INVENTORY_FILE=$2 | ||
if [ "x$INVENTORY_FILE" == "x" ]; then | ||
ansible-playbook $PLAYBOOK_FILE --syntax-check | ||
else | ||
ansible-playbook $PLAYBOOK_FILE -i $INVENTORY_FILE --syntax-check | ||
fi | ||
if [ $? -ne 0 ]; then | ||
echo "Syntax error in $PLAYBOOK_FILE" | ||
teardown | ||
exit 1 | ||
fi | ||
echo "$PLAYBOOK_FILE syntax is OK" | ||
} | ||
|
||
assertEquals() | ||
{ | ||
EXPECTED=$1 | ||
ACTUAL=$2 | ||
if [ "$ACTUAL" != "$EXPECTED" ]; then | ||
echo "Assertion error: $EXPECTED expected, but $ACTUAL gotten" | ||
teardown | ||
exit 1 | ||
fi | ||
} | ||
|
||
assertFileExists() | ||
{ | ||
FILE_PATH=$1 | ||
if [ ! -f $FILE_PATH ]; then | ||
echo "The file $FILE_PATH does not exist" | ||
teardown | ||
exit 1 | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters