From c1b403a51fbb1e1453a1ea2579739662203ea163 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Tue, 5 Dec 2023 18:03:38 -0700 Subject: [PATCH] refactor: get_ostree_data.sh use env shebang - remove from .sanity* Use the `#!/usr/bin/env bash` shebang which is ansible-test friendly. This means we can remove get_ostree_data.sh from the .sanity* files. This also means we can remove the .sanity* files if we do not need them otherwise. Rename `pth` to `path` in honor of nscott Signed-off-by: Rich Megginson --- .ostree/get_ostree_data.sh | 8 ++++---- .sanity-ansible-ignore-2.13.txt | 1 - .sanity-ansible-ignore-2.14.txt | 1 - .sanity-ansible-ignore-2.15.txt | 1 - .sanity-ansible-ignore-2.16.txt | 1 - 5 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.ostree/get_ostree_data.sh b/.ostree/get_ostree_data.sh index cec08b0c..65830d6b 100755 --- a/.ostree/get_ostree_data.sh +++ b/.ostree/get_ostree_data.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail @@ -28,7 +28,7 @@ if [ "$pkgtype" = testing ]; then fi get_rolepath() { - local ostree_dir role rolesdir roles_parent_dir coll_path pth + local ostree_dir role rolesdir roles_parent_dir coll_path path ostree_dir="$1" role="$2" roles_parent_dir="$(dirname "$(dirname "$ostree_dir")")" @@ -51,8 +51,8 @@ get_rolepath() { coll_path="${ANSIBLE_COLLECTIONS_PATHS:-}" fi if [ -n "${coll_path}" ]; then - for pth in ${coll_path//:/ }; do - for rolesdir in "$pth"/ansible_collections/*/*_system_roles/roles/"$role"/.ostree; do + for path in ${coll_path//:/ }; do + for rolesdir in "$path"/ansible_collections/*/*_system_roles/roles/"$role"/.ostree; do if [ -d "$rolesdir" ]; then echo "$rolesdir" return 0 diff --git a/.sanity-ansible-ignore-2.13.txt b/.sanity-ansible-ignore-2.13.txt index 351c1470..608d7700 100644 --- a/.sanity-ansible-ignore-2.13.txt +++ b/.sanity-ansible-ignore-2.13.txt @@ -29,4 +29,3 @@ plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.9!skip plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.10!skip tests/ha_cluster/unit/test_pcs_api_v2.py shebang!skip tests/ha_cluster/unit/test_pcs_qdevice_certs.py shebang!skip -roles/ha_cluster/.ostree/get_ostree_data.sh shebang!skip diff --git a/.sanity-ansible-ignore-2.14.txt b/.sanity-ansible-ignore-2.14.txt index 641760ec..60eb30b5 100644 --- a/.sanity-ansible-ignore-2.14.txt +++ b/.sanity-ansible-ignore-2.14.txt @@ -32,4 +32,3 @@ plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.10!skip plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.11!skip tests/ha_cluster/unit/test_pcs_api_v2.py shebang!skip tests/ha_cluster/unit/test_pcs_qdevice_certs.py shebang!skip -roles/ha_cluster/.ostree/get_ostree_data.sh shebang!skip diff --git a/.sanity-ansible-ignore-2.15.txt b/.sanity-ansible-ignore-2.15.txt index 641760ec..60eb30b5 100644 --- a/.sanity-ansible-ignore-2.15.txt +++ b/.sanity-ansible-ignore-2.15.txt @@ -32,4 +32,3 @@ plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.10!skip plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.11!skip tests/ha_cluster/unit/test_pcs_api_v2.py shebang!skip tests/ha_cluster/unit/test_pcs_qdevice_certs.py shebang!skip -roles/ha_cluster/.ostree/get_ostree_data.sh shebang!skip diff --git a/.sanity-ansible-ignore-2.16.txt b/.sanity-ansible-ignore-2.16.txt index b0a0ea34..0445e070 100644 --- a/.sanity-ansible-ignore-2.16.txt +++ b/.sanity-ansible-ignore-2.16.txt @@ -31,4 +31,3 @@ plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.11!skip plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.12!skip tests/ha_cluster/unit/test_pcs_api_v2.py shebang!skip tests/ha_cluster/unit/test_pcs_qdevice_certs.py shebang!skip -roles/ha_cluster/.ostree/get_ostree_data.sh shebang!skip