Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utils/build-galaxy-release.sh: Do not create duplicates for role plugins #1324

Merged
merged 2 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion roles/ipaserver/module_utils/ansible_ipa_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@

from __future__ import (absolute_import, division, print_function)

__metaclass__ = type # pylint: disable=invalid-name
# pylint: disable=invalid-name
__metaclass__ = type
# pylint: enable=invalid-name

__all__ = ["IPAChangeConf", "certmonger", "sysrestore", "root_logger",
"ipa_generate_password", "run", "ScriptError", "services",
Expand Down
27 changes: 8 additions & 19 deletions utils/build-galaxy-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,21 +140,18 @@ sed -i -e "s/ansible.module_utils.ansible_freeipa_module/ansible_collections.${c

python utils/create_action_group.py "meta/runtime.yml" "$collection_prefix"

(cd plugins/module_utils && {
ln -sf ../../roles/*/module_utils/*.py .
})
mv roles/*/module_utils/*.py plugins/module_utils/
rmdir roles/*/module_utils

(cd plugins/modules && {
sed -i -e "s/ansible.module_utils.ansible_ipa_/ansible_collections.${collection_prefix}.plugins.module_utils.ansible_ipa_/" ../../roles/*/library/*.py
ln -sf ../../roles/*/library/*.py .
})
sed -i -e "s/ansible.module_utils.ansible_ipa_/ansible_collections.${collection_prefix}.plugins.module_utils.ansible_ipa_/" roles/*/library/*.py
mv roles/*/library/*.py plugins/modules/
rmdir roles/*/library

# There are no action plugins anymore in the roles, therefore this section
# is commneted out.
#[ ! -x plugins/action ] && mkdir plugins/action
#(cd plugins/action && {
# ln -sf ../../roles/*/action_plugins/*.py .
#})
#mv roles/*/action_plugins/*.py plugins/action/
#rmdir roles/*/action_plugins

# Adapt inventory plugin and inventory plugin README
echo "Fixing inventory plugin and doc..."
Expand All @@ -181,19 +178,11 @@ find plugins/modules -name "*.py" -print0 |
done
echo -e "\033[AFixing examples in plugins/modules... \033[32;1mDONE\033[0m"

echo "Fixing examples in roles/*/library..."
find roles/*/library -name "*.py" -print0 |
while IFS= read -d '' -r line; do
python utils/galaxyfy-module-EXAMPLES.py "$line" \
"ipa" "$collection_prefix"
done
echo -e "\033[AFixing examples in roles/*/library... \033[32;1mDONE\033[0m"

echo "Fixing playbooks in roles/*/tasks..."
for line in roles/*/tasks/*.yml; do
python utils/galaxyfy-playbook.py "$line" "ipa" "$collection_prefix"
done
echo -e "\033[AFixing playbooks in roles/*tasks... \033[32;1mDONE\033[0m"
echo -e "\033[AFixing playbooks in roles/*/tasks... \033[32;1mDONE\033[0m"

echo "Fixing playbooks in playbooks..."
find playbooks -name "*.yml" -print0 |
Expand Down
Loading