aboutsummaryrefslogtreecommitdiff
path: root/tests/link-module-utils.sh
blob: 08819a8281c225c2848e6cc863c80dc76e56e57a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env bash

# NOTE(hinermar): During deployment, Ansible handles module discovery
# automatically. In testing environment this feature is
# not present so it's necessary to link module files to environment
# package directory so they can be discovered by python interpreter.


local_module_utils=${1}/ansible/module_utils
env_module_utils=$(/usr/bin/env python -c "import ansible; print(ansible.__path__[0] + '/module_utils')")

for file_path in ${local_module_utils}/*.py; do
    file_name=$(basename ${file_path})
    source=$(realpath ${file_path})
    destination=$(realpath ${env_module_utils})/${file_name}
    ln -fs ${source} ${destination}
done