fix reject list (#79391)

pull/79227/head
Brian Coca 2 years ago committed by GitHub
parent 942bcf6e7a
commit 1bda6750f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,6 +1,6 @@
---
filter_version: '1.0'
module_blacklist:
# List the modules to blacklist here
module_rejectlist:
# List the modules to reject here
#- easy_install
#- s3

@ -1385,14 +1385,21 @@ def _load_plugin_filter():
version = to_text(version)
version = version.strip()
if version == u'1.0':
# Modules and action plugins share the same blacklist since the difference between the
# Modules and action plugins share the same reject list since the difference between the
# two isn't visible to the users
if version == u'1.0':
if 'module_blacklist' in filter_data:
display.deprecated("'module_blacklist' is being removed in favor of 'module_rejectlist'", version='2.18')
if 'module_rejectlist' not in filter_data:
filter_data['module_rejectlist'] = filter_data['module_blacklist']
del filter_data['module_blacklist']
try:
filters['ansible.modules'] = frozenset(filter_data['module_blacklist'])
filters['ansible.modules'] = frozenset(filter_data['module_rejectlist'])
except TypeError:
display.warning(u'Unable to parse the plugin filter file {0} as'
u' module_blacklist is not a list.'
u' module_rejectlist is not a list.'
u' Skipping.'.format(filter_cfg))
return filters
filters['ansible.plugins.action'] = filters['ansible.modules']
@ -1404,11 +1411,11 @@ def _load_plugin_filter():
display.warning(u'The plugin filter file, {0} does not exist.'
u' Skipping.'.format(filter_cfg))
# Specialcase the stat module as Ansible can run very few things if stat is blacklisted.
# Specialcase the stat module as Ansible can run very few things if stat is rejected
if 'stat' in filters['ansible.modules']:
raise AnsibleError('The stat module was specified in the module blacklist file, {0}, but'
raise AnsibleError('The stat module was specified in the module reject list file, {0}, but'
' Ansible will not function without the stat module. Please remove stat'
' from the blacklist.'.format(to_native(filter_cfg)))
' from the reject list.'.format(to_native(filter_cfg)))
return filters

@ -1,6 +1,6 @@
---
filter_version: 1.0
module_blacklist:
module_rejectlist:
# Specify the name of a lookup plugin here. This should have no effect as
# this is only for filtering modules
- list

@ -1,6 +1,6 @@
---
filter_version: 1.0
module_blacklist:
module_rejectlist:
# A pure action plugin
- pause
# A hybrid action plugin with module

@ -1,5 +1,5 @@
---
filter_version: 1.0
module_blacklist:
module_rejectlist:
# Ping is special
- ping

@ -1,5 +1,5 @@
---
filter_version: 1.0
module_blacklist:
module_rejectlist:
# Stat is special
- stat

@ -1,3 +0,0 @@
[defaults]
retry_files_enabled = False
plugin_filters_cfg = ./no_blacklist_module.yml

@ -22,11 +22,11 @@ if test $? != 0 ; then
fi
#
# Check that if no modules are blacklisted then Ansible should not through traceback
# Check that if no modules are rejected then Ansible should not through traceback
#
ANSIBLE_CONFIG=no_blacklist_module.ini ansible-playbook tempfile.yml -i ../../inventory -vvv "$@"
ANSIBLE_CONFIG=no_rejectlist_module.ini ansible-playbook tempfile.yml -i ../../inventory -vvv "$@"
if test $? != 0 ; then
echo "### Failed to run tempfile with no modules blacklisted"
echo "### Failed to run tempfile with no modules rejected"
exit 1
fi
@ -87,7 +87,7 @@ fi
ANSIBLE_CONFIG=filter_lookup.ini ansible-playbook lookup.yml -i ../../inventory -vvv "$@"
if test $? != 0 ; then
echo "### Failed to use a lookup plugin when it is incorrectly specified in the *module* blacklist"
echo "### Failed to use a lookup plugin when it is incorrectly specified in the *module* reject list"
exit 1
fi
@ -107,10 +107,10 @@ ANSIBLE_CONFIG=filter_stat.ini
export ANSIBLE_CONFIG
CAPTURE=$(ansible-playbook copy.yml -i ../../inventory -vvv "$@" 2>&1)
if test $? = 0 ; then
echo "### Copy ran even though stat is in the module blacklist"
echo "### Copy ran even though stat is in the module reject list"
exit 1
else
echo "$CAPTURE" | grep 'The stat module was specified in the module blacklist file,.*, but Ansible will not function without the stat module. Please remove stat from the blacklist.'
echo "$CAPTURE" | grep 'The stat module was specified in the module reject list file,.*, but Ansible will not function without the stat module. Please remove stat from the reject list.'
if test $? != 0 ; then
echo "### Stat did not give us our custom error message"
exit 1
@ -124,10 +124,10 @@ ANSIBLE_CONFIG=filter_stat.ini
export ANSIBLE_CONFIG
CAPTURE=$(ansible-playbook stat.yml -i ../../inventory -vvv "$@" 2>&1)
if test $? = 0 ; then
echo "### Stat ran even though it is in the module blacklist"
echo "### Stat ran even though it is in the module reject list"
exit 1
else
echo "$CAPTURE" | grep 'The stat module was specified in the module blacklist file,.*, but Ansible will not function without the stat module. Please remove stat from the blacklist.'
echo "$CAPTURE" | grep 'The stat module was specified in the module reject list file,.*, but Ansible will not function without the stat module. Please remove stat from the reject list.'
if test $? != 0 ; then
echo "### Stat did not give us our custom error message"
exit 1

Loading…
Cancel
Save