diff --git a/linux-system-roles.spec b/linux-system-roles.spec index b56a230..4d690dd 100644 --- a/linux-system-roles.spec +++ b/linux-system-roles.spec @@ -56,8 +56,8 @@ Provides: ansible-collection(%{collection_namespace}.%{collection_name}) = %{col %define ansible_roles_dir %{_datadir}/ansible/roles %if %{without ansible} # Untar and copy everything instead of galaxy-installing the built artifact when ansible is not available -%define ansible_collection_build() tar -cf %{_tmppath}/%{collection_namespace}-%{collection_name}-%{version}.tar.gz . -%define ansible_collection_install() mkdir -p %{buildroot}%{ansible_collection_files}%{collection_name}; (cd %{buildroot}%{ansible_collection_files}%{collection_name}; tar -xf %{_tmppath}/%{collection_namespace}-%{collection_name}-%{version}.tar.gz) +%define ansible_collection_build() tar -cf %{collection_namespace}-%{collection_name}-%{version}.tar.gz . +%define ansible_collection_install() mkdir -p %{buildroot}%{ansible_collection_files}%{collection_name}; tar -xf %{collection_namespace}-%{collection_name}-%{version}.tar.gz --directory %{buildroot}%{ansible_collection_files}%{collection_name} %else %define ansible_collection_build() ansible-galaxy collection build %define ansible_collection_install() ansible-galaxy collection install -n -p %{buildroot}%{_datadir}/ansible/collections %{collection_namespace}-%{collection_name}-%{version}.tar.gz @@ -388,9 +388,22 @@ for module in "${!module_map[@]}"; do if [ ! -f $moduledir/$module ]; then moduledir=.external/community/general/plugins/modules/files fi - cp -pL $moduledir/$module $role/library/$module - ls -alrtF $role/library/$module + module_target=$role/library/$module + cp -pL $moduledir/$module $module_target + ls -alrtF $module_target sed -i -e ':a;N;$!ba;s/description:\n\( *\)/description:\n\1- WARNING: Do not use this module directly! It is only for role internal use.\n\1/' $role/library/$module + + # Remove doc_fragments from vendored modules + if grep -q extends_documentation_fragment $module_target; then + top_line=$(grep extends_documentation_fragment $module_target -n | cut -d":" -f1) + bottom_line=$((top_line+1)) + # While $bottom_line is still in the extends_documentation_fragment yaml list + while sed -n ${bottom_line}p $module_target | grep '\-\s' > /dev/null; do + rm_lines="$top_line,$bottom_line" + bottom_line=$((bottom_line+1)) + done + sed -i "${rm_lines}d" $module_target + fi done # Fix until the updated redhat_subscription.py is in community.general