summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Coca <bcoca@users.noreply.github.com>2022-11-18 14:26:35 -0500
committerGitHub <noreply@github.com>2022-11-18 14:26:35 -0500
commit1bda6750f5f4fb8b01de21d1949b02d7547ff838 (patch)
tree569f4451a171214ceaa22fef9391f6554cde6f81
parent942bcf6e7a911430694e08dd604d62576ca7d6f2 (diff)
downloadansible-1bda6750f5f4fb8b01de21d1949b02d7547ff838.tar.gz
fix reject list (#79391)
-rw-r--r--examples/plugin_filters.yml4
-rw-r--r--lib/ansible/plugins/loader.py21
-rw-r--r--test/integration/targets/plugin_filtering/filter_lookup.yml2
-rw-r--r--test/integration/targets/plugin_filtering/filter_modules.yml2
-rw-r--r--test/integration/targets/plugin_filtering/filter_ping.yml2
-rw-r--r--test/integration/targets/plugin_filtering/filter_stat.yml2
-rw-r--r--test/integration/targets/plugin_filtering/no_blacklist_module.ini3
-rw-r--r--test/integration/targets/plugin_filtering/no_rejectlist_module.yml (renamed from test/integration/targets/plugin_filtering/no_blacklist_module.yml)2
-rwxr-xr-xtest/integration/targets/plugin_filtering/runme.sh16
9 files changed, 29 insertions, 25 deletions
diff --git a/examples/plugin_filters.yml b/examples/plugin_filters.yml
index b089a4d1f8..4495676a4a 100644
--- a/examples/plugin_filters.yml
+++ b/examples/plugin_filters.yml
@@ -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
diff --git a/lib/ansible/plugins/loader.py b/lib/ansible/plugins/loader.py
index d09138b12f..9d1a72694c 100644
--- a/lib/ansible/plugins/loader.py
+++ b/lib/ansible/plugins/loader.py
@@ -1385,14 +1385,21 @@ def _load_plugin_filter():
version = to_text(version)
version = version.strip()
+ # 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':
- # Modules and action plugins share the same blacklist since the difference between the
- # two isn't visible to the users
+
+ 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
diff --git a/test/integration/targets/plugin_filtering/filter_lookup.yml b/test/integration/targets/plugin_filtering/filter_lookup.yml
index 694ebfcb72..5f183e9f1a 100644
--- a/test/integration/targets/plugin_filtering/filter_lookup.yml
+++ b/test/integration/targets/plugin_filtering/filter_lookup.yml
@@ -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
diff --git a/test/integration/targets/plugin_filtering/filter_modules.yml b/test/integration/targets/plugin_filtering/filter_modules.yml
index 6cffa67614..bef7d6d809 100644
--- a/test/integration/targets/plugin_filtering/filter_modules.yml
+++ b/test/integration/targets/plugin_filtering/filter_modules.yml
@@ -1,6 +1,6 @@
---
filter_version: 1.0
-module_blacklist:
+module_rejectlist:
# A pure action plugin
- pause
# A hybrid action plugin with module
diff --git a/test/integration/targets/plugin_filtering/filter_ping.yml b/test/integration/targets/plugin_filtering/filter_ping.yml
index 08e56f2439..8604716e91 100644
--- a/test/integration/targets/plugin_filtering/filter_ping.yml
+++ b/test/integration/targets/plugin_filtering/filter_ping.yml
@@ -1,5 +1,5 @@
---
filter_version: 1.0
-module_blacklist:
+module_rejectlist:
# Ping is special
- ping
diff --git a/test/integration/targets/plugin_filtering/filter_stat.yml b/test/integration/targets/plugin_filtering/filter_stat.yml
index c1ce42efd7..132bf03f31 100644
--- a/test/integration/targets/plugin_filtering/filter_stat.yml
+++ b/test/integration/targets/plugin_filtering/filter_stat.yml
@@ -1,5 +1,5 @@
---
filter_version: 1.0
-module_blacklist:
+module_rejectlist:
# Stat is special
- stat
diff --git a/test/integration/targets/plugin_filtering/no_blacklist_module.ini b/test/integration/targets/plugin_filtering/no_blacklist_module.ini
deleted file mode 100644
index 65b51d6712..0000000000
--- a/test/integration/targets/plugin_filtering/no_blacklist_module.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[defaults]
-retry_files_enabled = False
-plugin_filters_cfg = ./no_blacklist_module.yml
diff --git a/test/integration/targets/plugin_filtering/no_blacklist_module.yml b/test/integration/targets/plugin_filtering/no_rejectlist_module.yml
index 52a55dff3c..91e60a1fcd 100644
--- a/test/integration/targets/plugin_filtering/no_blacklist_module.yml
+++ b/test/integration/targets/plugin_filtering/no_rejectlist_module.yml
@@ -1,3 +1,3 @@
---
filter_version: 1.0
-module_blacklist:
+module_rejectlist:
diff --git a/test/integration/targets/plugin_filtering/runme.sh b/test/integration/targets/plugin_filtering/runme.sh
index aa0e2b0c2a..03d78abc61 100755
--- a/test/integration/targets/plugin_filtering/runme.sh
+++ b/test/integration/targets/plugin_filtering/runme.sh
@@ -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