2017-08-02 01:18:27 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# We're getting rid of get_exception in our code so that we can deprecate it.
|
|
|
|
# get_exception is no longer needed as we no longer support python-2.4 on the controller.
|
|
|
|
|
2017-08-12 05:23:17 +02:00
|
|
|
# We eventually want pycompat24 and basic.py to be the only things on this list
|
2017-08-02 01:18:27 +02:00
|
|
|
get_exception=$(find . -path ./test/runner/.tox -prune \
|
2017-08-12 05:23:17 +02:00
|
|
|
-o -path ./lib/ansible/module_utils/pycompat24.py -prune \
|
|
|
|
-o -path ./lib/ansible/module_utils/basic.py -prune \
|
2017-08-02 01:18:27 +02:00
|
|
|
-o -path ./lib/ansible/modules/storage/netapp -prune \
|
2018-02-01 21:24:07 +01:00
|
|
|
-o -path ./lib/ansible/modules/packaging/os/apt.py -prune \
|
|
|
|
-o -path ./lib/ansible/modules/packaging/os/apt_repository.py -prune \
|
|
|
|
-o -path ./lib/ansible/modules/packaging/os/yum_repository.py -prune \
|
2017-08-02 01:18:27 +02:00
|
|
|
-o -path ./lib/ansible/modules/network/panos -prune \
|
2018-02-01 21:24:07 +01:00
|
|
|
-o -path ./lib/ansible/modules/network/junos/junos_facts.py -prune \
|
|
|
|
-o -path ./lib/ansible/modules/network/junos/junos_scp.py -prune \
|
|
|
|
-o -path ./lib/ansible/modules/network/junos/junos_package.py -prune \
|
|
|
|
-o -path ./lib/ansible/modules/network/vyos/vyos_command.py -prune \
|
|
|
|
-o -path ./lib/ansible/modules/network/fortios/fortios_address.py -prune \
|
|
|
|
-o -path ./lib/ansible/modules/network/cloudengine/ce_file_copy.py -prune \
|
|
|
|
-o -path ./lib/ansible/modules/network/aos/aos_blueprint_param.py -prune \
|
|
|
|
-o -path ./lib/ansible/modules/network/aos/aos_blueprint.py -prune \
|
|
|
|
-o -path ./lib/ansible/modules/network/aos/aos_blueprint_virtnet.py -prune \
|
|
|
|
-o -path ./lib/ansible/modules/network/eos/eos_command.py -prune \
|
|
|
|
-o -path ./lib/ansible/modules/files/xattr.py -prune \
|
|
|
|
-o -path ./lib/ansible/modules/files/acl.py -prune \
|
2017-08-02 01:18:27 +02:00
|
|
|
-o -path ./lib/ansible/modules/system -prune \
|
2018-02-01 21:24:07 +01:00
|
|
|
-o -path ./lib/ansible/modules/web_infrastructure/jenkins_plugin.py -prune \
|
|
|
|
-o -path ./lib/ansible/modules/web_infrastructure/taiga_issue.py -prune \
|
|
|
|
-o -path ./lib/ansible/modules/web_infrastructure/htpasswd.py -prune \
|
2017-08-02 01:18:27 +02:00
|
|
|
-o -name '*.py' -type f -exec grep -H 'get_exception' '{}' '+')
|
|
|
|
|
2017-08-12 05:23:17 +02:00
|
|
|
basic_failed=0
|
2017-08-02 01:18:27 +02:00
|
|
|
|
2017-08-12 05:23:17 +02:00
|
|
|
if test "$(grep -c get_exception ./lib/ansible/module_utils/basic.py)" -gt 1 ; then
|
|
|
|
printf "\n== basic.py contains get_exception calls ==\n\n"
|
|
|
|
printf " basic.py is allowed to import get_exception for backwards compat but\n"
|
|
|
|
printf " should not call it anywhere\n"
|
|
|
|
basic_failed=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
failures=0
|
2017-08-02 01:18:27 +02:00
|
|
|
if test -n "$get_exception" ; then
|
|
|
|
printf "\n== Contains get_exception() calls ==\n"
|
2017-08-12 05:23:17 +02:00
|
|
|
printf " %s\n" "$get_exception"
|
2017-08-02 01:18:27 +02:00
|
|
|
failures=$(printf "%s" "$get_exception"| wc -l)
|
|
|
|
failures=$((failures + 2))
|
|
|
|
fi
|
|
|
|
|
2017-08-12 05:23:17 +02:00
|
|
|
exit $((basic_failed + failures))
|