-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Add test for argument_specs matching (#177)
* fix: Add test for argument_specs matching Compare contents of `meta/arguments_spec.yml` against `defaults/main.yml` on each role to make sure keys match. Signed-off-by: SuperQ <[email protected]> * Fixup arguments_spec linting issues. Signed-off-by: SuperQ <[email protected]> --------- Signed-off-by: SuperQ <[email protected]>
- Loading branch information
Showing
5 changed files
with
48 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Description: Lint the defaults/main.yml against the meta/arguments_spec.yml | ||
|
||
lint_diff() { | ||
diff -u \ | ||
<(yq 'keys | .[]' "${role}/defaults/main.yml" | sort -u) \ | ||
<(yq '.argument_specs.main.options | keys | .[] ' "${role}/meta/argument_specs.yml" | sort -u) | ||
return $? | ||
} | ||
|
||
error=0 | ||
|
||
for role in roles/* ; do | ||
echo "Checking ${role}" | ||
if ! lint_diff ; then | ||
echo "ERROR: ${role}: meta/argument_specs.yml doesn't match defaults/main.yml" | ||
error=1 | ||
fi | ||
done | ||
|
||
exit "${error}" |
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
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