2015-10-20 01:39:15 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2016-11-08 00:46:33 +00:00
|
|
|
metaclass1=$(find ./bin -type f -exec grep -HL '__metaclass__ = type' '{}' '+')
|
|
|
|
future1=$(find ./bin -type f -exec grep -HL 'from __future__ import (absolute_import, division, print_function)' '{}' '+')
|
2015-10-20 01:39:15 +00:00
|
|
|
|
2017-08-12 03:23:17 +00:00
|
|
|
# We eventually want to remove the module_utils pruning from metaclass2 and future2
|
2016-12-06 16:29:16 +00:00
|
|
|
metaclass2=$(find ./lib/ansible -path ./lib/ansible/modules -prune \
|
2015-10-20 01:39:15 +00:00
|
|
|
-o -path ./lib/ansible/module_utils -prune \
|
2017-03-23 20:35:05 +00:00
|
|
|
-o -path ./lib/ansible/module_utils/six/_six.py -prune \
|
2017-02-01 16:48:23 +00:00
|
|
|
-o -path ./lib/ansible/compat/selectors/_selectors2.py -prune \
|
2015-10-20 01:39:15 +00:00
|
|
|
-o -path ./lib/ansible/utils/module_docs_fragments -prune \
|
2017-07-28 21:15:23 +00:00
|
|
|
-o -name '*.py' -type f -size +0c -exec grep -HL '__metaclass__ = type' '{}' '+')
|
2015-10-20 01:39:15 +00:00
|
|
|
|
2016-12-06 16:29:16 +00:00
|
|
|
future2=$(find ./lib/ansible -path ./lib/ansible/modules -prune \
|
2015-10-20 01:39:15 +00:00
|
|
|
-o -path ./lib/ansible/module_utils -prune \
|
2017-03-23 20:35:05 +00:00
|
|
|
-o -path ./lib/ansible/module_utils/six/_six.py -prune \
|
2017-02-01 16:48:23 +00:00
|
|
|
-o -path ./lib/ansible/compat/selectors/_selectors2.py -prune \
|
2015-10-20 01:39:15 +00:00
|
|
|
-o -path ./lib/ansible/utils/module_docs_fragments -prune \
|
2017-07-28 21:15:23 +00:00
|
|
|
-o -name '*.py' -type f -size +0c -exec grep -HL 'from __future__ import (absolute_import, division, print_function)' '{}' '+')
|
|
|
|
|
|
|
|
# Eventually we want metaclass3 and future3 to get down to 0
|
|
|
|
metaclass3=$(find ./lib/ansible/modules -path ./lib/ansible/modules/windows -prune \
|
|
|
|
-o -path ./lib/ansible/modules/cloud/ovirt -prune \
|
|
|
|
-o -path ./lib/ansible/modules/cloud/cloudstack -prune \
|
|
|
|
-o -path ./lib/ansible/modules/cloud/amazon -prune \
|
2017-07-29 21:14:16 +00:00
|
|
|
-o -path ./lib/ansible/modules/network/aos -prune \
|
|
|
|
-o -path ./lib/ansible/modules/network/avi -prune \
|
|
|
|
-o -path ./lib/ansible/modules/network/cloudengine -prune \
|
|
|
|
-o -path ./lib/ansible/modules/network/eos -prune \
|
|
|
|
-o -path ./lib/ansible/modules/network/ios -prune \
|
|
|
|
-o -path ./lib/ansible/modules/network/netvisor -prune \
|
|
|
|
-o -path ./lib/ansible/modules/network/nxos -prune \
|
|
|
|
-o -path ./lib/ansible/modules/network/panos -prune \
|
|
|
|
-o -path ./lib/ansible/modules/network/vyos -prune \
|
2017-07-28 21:15:23 +00:00
|
|
|
-o -name '*.py' -type f -size +0c -exec grep -HL '__metaclass__ = type' '{}' '+')
|
|
|
|
|
|
|
|
future3=$(find ./lib/ansible/modules -path ./lib/ansible/modules/windows -prune \
|
|
|
|
-o -path ./lib/ansible/modules/cloud/ovirt -prune \
|
|
|
|
-o -path ./lib/ansible/modules/cloud/cloudstack -prune \
|
|
|
|
-o -path ./lib/ansible/modules/cloud/amazon -prune \
|
2017-07-29 21:14:16 +00:00
|
|
|
-o -path ./lib/ansible/modules/network/aos -prune \
|
|
|
|
-o -path ./lib/ansible/modules/network/avi -prune \
|
|
|
|
-o -path ./lib/ansible/modules/network/cloudengine -prune \
|
|
|
|
-o -path ./lib/ansible/modules/network/eos -prune \
|
|
|
|
-o -path ./lib/ansible/modules/network/ios -prune \
|
|
|
|
-o -path ./lib/ansible/modules/network/netvisor -prune \
|
|
|
|
-o -path ./lib/ansible/modules/network/nxos -prune \
|
|
|
|
-o -path ./lib/ansible/modules/network/panos -prune \
|
|
|
|
-o -path ./lib/ansible/modules/network/vyos -prune \
|
2017-07-28 21:15:23 +00:00
|
|
|
-o -name '*.py' -type f -size +0c -exec egrep -HL 'from __future__ import (?absolute_import, division, print_function)?' '{}' '+')
|
2015-10-20 01:39:15 +00:00
|
|
|
|
2017-08-01 23:18:27 +00:00
|
|
|
###
|
|
|
|
### Important: If you're looking for a list of files to cleanup for boilerplate
|
|
|
|
### Look at this wikipage instead: https://github.com/ansible/community/wiki/Testing:-boilerplate,-wildcard-imports,-and-get_exception
|
|
|
|
###
|
2017-07-29 21:14:16 +00:00
|
|
|
|
2015-10-20 01:39:15 +00:00
|
|
|
### TODO:
|
2017-07-29 21:14:16 +00:00
|
|
|
### - module_utils <=== these are important but not well organized so we'd
|
2017-10-09 16:56:26 +00:00
|
|
|
### have to construct the test file by file
|
2017-07-29 21:14:16 +00:00
|
|
|
### - contrib/ <=== Not a priority as these will move to inventory plugins over time
|
2015-10-20 01:39:15 +00:00
|
|
|
|
|
|
|
|
2017-07-28 21:15:23 +00:00
|
|
|
if test -n "$metaclass1" -o -n "$metaclass2" -o -n "$metaclass3" ; then
|
2015-10-20 01:39:15 +00:00
|
|
|
printf "\n== Missing __metaclass__ = type ==\n"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -n "$metaclass1" ; then
|
2018-01-11 19:08:40 +00:00
|
|
|
printf "%s\n" "$metaclass1"
|
2015-10-20 01:39:15 +00:00
|
|
|
fi
|
|
|
|
if test -n "$metaclass2" ; then
|
2018-01-11 19:08:40 +00:00
|
|
|
printf "%s\n" "$metaclass2"
|
2015-10-20 01:39:15 +00:00
|
|
|
fi
|
2017-07-28 21:15:23 +00:00
|
|
|
if test -n "$metaclass3" ; then
|
2018-01-11 19:08:40 +00:00
|
|
|
printf "%s\n" "$metaclass3"
|
2017-07-28 21:15:23 +00:00
|
|
|
fi
|
2015-10-20 01:39:15 +00:00
|
|
|
|
2017-07-28 21:15:23 +00:00
|
|
|
if test -n "$future1" -o -n "$future2" -o -n "$future3" ; then
|
2015-10-20 01:39:15 +00:00
|
|
|
printf "\n== Missing from __future__ import (absolute_import, division, print_function) ==\n"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -n "$future1" ; then
|
2018-01-11 19:08:40 +00:00
|
|
|
printf "%s\n" "$future1"
|
2015-10-20 01:39:15 +00:00
|
|
|
fi
|
|
|
|
if test -n "$future2" ; then
|
2018-01-11 19:08:40 +00:00
|
|
|
printf "%s\n" "$future2"
|
2015-10-20 01:39:15 +00:00
|
|
|
fi
|
2017-07-28 21:15:23 +00:00
|
|
|
if test -n "$future3" ; then
|
2018-01-11 19:08:40 +00:00
|
|
|
printf "%s\n" "$future3"
|
2017-07-28 21:15:23 +00:00
|
|
|
fi
|
2015-10-20 01:39:15 +00:00
|
|
|
|
2017-07-28 21:15:23 +00:00
|
|
|
if test -n "$future1$future2$future3$metaclass1$metaclass2$metaclass3" ; then
|
2018-01-11 19:08:40 +00:00
|
|
|
exit 2
|
2015-10-20 01:39:15 +00:00
|
|
|
fi
|
|
|
|
exit 0
|