mirror of
https://github.com/prometheus-community/ansible
synced 2024-11-22 20:03:04 +00:00
100b6e2070
* 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 <superq@gmail.com> * Fixup arguments_spec linting issues. Signed-off-by: SuperQ <superq@gmail.com> --------- Signed-off-by: SuperQ <superq@gmail.com>
22 lines
510 B
Bash
Executable file
22 lines
510 B
Bash
Executable file
#!/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}"
|