mirror of
https://github.com/willshersystems/ansible-sshd
synced 2024-11-24 20:10:20 +01:00
a25523ddce
The old ansible-community ansible-lint is deprecated. There is a new ansible-lint github action. The latest Ansible repo gating tests run ansible-lint against the collection format instead of against individual roles. We have to convert the role to collection format before running ansible-test. This also requires tox-lsr 3.2.1 Role developers can run this locally using `tox -e collection,ansible-lint-collection` See https://github.com/linux-system-roles/tox-lsr/pull/125 Fix ansible-lint and ansible-test issues reported by the latest 2.16 versions. Signed-off-by: Rich Megginson <rmeggins@redhat.com>
48 lines
1.4 KiB
Bash
Executable file
48 lines
1.4 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
declare -A os_family=( [RedHat]=RedHat [CentOS]=RedHat [Fedora]=RedHat
|
|
[AlmaLinux]=RedHat [Rocky]=RedHat [OracleLinux]=RedHat )
|
|
|
|
for file in vars/*.yml; do
|
|
if [ "$file" = vars/main.yml ]; then
|
|
continue
|
|
fi
|
|
# get platform and optional version
|
|
if [[ "$file" =~ vars/([^_]+)_([0-9]+).yml$ ]]; then
|
|
platform="${BASH_REMATCH[1]}"
|
|
version="${BASH_REMATCH[2]}"
|
|
packages_file=".ostree/packages-runtime-${platform}-${version}.txt"
|
|
elif [[ "$file" =~ vars/([^_.]+).yml$ ]]; then
|
|
platform="${BASH_REMATCH[1]}"
|
|
packages_file=".ostree/packages-runtime-${platform}.txt"
|
|
else
|
|
echo ERROR: cannot parse "$file"
|
|
exit 1
|
|
fi
|
|
# only os_family == RedHat is supported
|
|
if [ "${os_family[$platform]:-}" = RedHat ]; then
|
|
: # proceed - fall through
|
|
else
|
|
echo platform "$platform" not supported for ostree
|
|
continue
|
|
fi
|
|
# parse packages from file
|
|
printit=0
|
|
while read -r item pkg; do
|
|
if [[ "$item" =~ ^__sshd_packages: ]]; then
|
|
printit=1
|
|
elif [ "$printit" = 1 ]; then
|
|
if [ "$item" = "-" ] && [ -n "$pkg" ]; then
|
|
echo "$pkg"
|
|
else
|
|
break
|
|
fi
|
|
fi
|
|
done < "$file" | sort > "$packages_file"
|
|
# remove empty files
|
|
if [ ! -s "$packages_file" ]; then
|
|
rm -f "$packages_file"
|
|
fi
|
|
done
|