mirror of
https://github.com/ansible/ansible-documentation.git
synced 2026-03-26 13:18:58 +07:00
fix reject list (#79391)
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
filter_version: '1.0'
|
filter_version: '1.0'
|
||||||
module_blacklist:
|
module_rejectlist:
|
||||||
# List the modules to blacklist here
|
# List the modules to reject here
|
||||||
#- easy_install
|
#- easy_install
|
||||||
#- s3
|
#- s3
|
||||||
|
|||||||
@@ -1385,14 +1385,21 @@ def _load_plugin_filter():
|
|||||||
version = to_text(version)
|
version = to_text(version)
|
||||||
version = version.strip()
|
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':
|
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:
|
try:
|
||||||
filters['ansible.modules'] = frozenset(filter_data['module_blacklist'])
|
filters['ansible.modules'] = frozenset(filter_data['module_rejectlist'])
|
||||||
except TypeError:
|
except TypeError:
|
||||||
display.warning(u'Unable to parse the plugin filter file {0} as'
|
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))
|
u' Skipping.'.format(filter_cfg))
|
||||||
return filters
|
return filters
|
||||||
filters['ansible.plugins.action'] = filters['ansible.modules']
|
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.'
|
display.warning(u'The plugin filter file, {0} does not exist.'
|
||||||
u' Skipping.'.format(filter_cfg))
|
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']:
|
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'
|
' 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
|
return filters
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
filter_version: 1.0
|
filter_version: 1.0
|
||||||
module_blacklist:
|
module_rejectlist:
|
||||||
# Specify the name of a lookup plugin here. This should have no effect as
|
# Specify the name of a lookup plugin here. This should have no effect as
|
||||||
# this is only for filtering modules
|
# this is only for filtering modules
|
||||||
- list
|
- list
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
filter_version: 1.0
|
filter_version: 1.0
|
||||||
module_blacklist:
|
module_rejectlist:
|
||||||
# A pure action plugin
|
# A pure action plugin
|
||||||
- pause
|
- pause
|
||||||
# A hybrid action plugin with module
|
# A hybrid action plugin with module
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
filter_version: 1.0
|
filter_version: 1.0
|
||||||
module_blacklist:
|
module_rejectlist:
|
||||||
# Ping is special
|
# Ping is special
|
||||||
- ping
|
- ping
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
filter_version: 1.0
|
filter_version: 1.0
|
||||||
module_blacklist:
|
module_rejectlist:
|
||||||
# Stat is special
|
# Stat is special
|
||||||
- stat
|
- stat
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
[defaults]
|
|
||||||
retry_files_enabled = False
|
|
||||||
plugin_filters_cfg = ./no_blacklist_module.yml
|
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
---
|
---
|
||||||
filter_version: 1.0
|
filter_version: 1.0
|
||||||
module_blacklist:
|
module_rejectlist:
|
||||||
@@ -22,11 +22,11 @@ if test $? != 0 ; then
|
|||||||
fi
|
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
|
if test $? != 0 ; then
|
||||||
echo "### Failed to run tempfile with no modules blacklisted"
|
echo "### Failed to run tempfile with no modules rejected"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ fi
|
|||||||
|
|
||||||
ANSIBLE_CONFIG=filter_lookup.ini ansible-playbook lookup.yml -i ../../inventory -vvv "$@"
|
ANSIBLE_CONFIG=filter_lookup.ini ansible-playbook lookup.yml -i ../../inventory -vvv "$@"
|
||||||
if test $? != 0 ; then
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -107,10 +107,10 @@ ANSIBLE_CONFIG=filter_stat.ini
|
|||||||
export ANSIBLE_CONFIG
|
export ANSIBLE_CONFIG
|
||||||
CAPTURE=$(ansible-playbook copy.yml -i ../../inventory -vvv "$@" 2>&1)
|
CAPTURE=$(ansible-playbook copy.yml -i ../../inventory -vvv "$@" 2>&1)
|
||||||
if test $? = 0 ; then
|
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
|
exit 1
|
||||||
else
|
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
|
if test $? != 0 ; then
|
||||||
echo "### Stat did not give us our custom error message"
|
echo "### Stat did not give us our custom error message"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -124,10 +124,10 @@ ANSIBLE_CONFIG=filter_stat.ini
|
|||||||
export ANSIBLE_CONFIG
|
export ANSIBLE_CONFIG
|
||||||
CAPTURE=$(ansible-playbook stat.yml -i ../../inventory -vvv "$@" 2>&1)
|
CAPTURE=$(ansible-playbook stat.yml -i ../../inventory -vvv "$@" 2>&1)
|
||||||
if test $? = 0 ; then
|
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
|
exit 1
|
||||||
else
|
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
|
if test $? != 0 ; then
|
||||||
echo "### Stat did not give us our custom error message"
|
echo "### Stat did not give us our custom error message"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user