diff options
author | Brian Coca <bcoca@users.noreply.github.com> | 2020-10-30 17:13:12 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-30 17:13:12 -0400 |
commit | 4b673484f06fa9464601c27706c8a43d1e11bbcb (patch) | |
tree | 1aec7e4e0b871465eee0470d0d34ea932e2fadbb /lib/ansible | |
parent | 4fb336cef13e4b6e2b46a4d30e60d1d40cbbbd90 (diff) | |
download | ansible-4b673484f06fa9464601c27706c8a43d1e11bbcb.tar.gz |
rethink wording (#70028)
* rethink wording
* removed unrequired requirement
* fix tests
* fixed versions
Co-authored-by: Sloane Hertel <shertel@redhat.com>
Diffstat (limited to 'lib/ansible')
-rw-r--r-- | lib/ansible/cli/adhoc.py | 2 | ||||
-rw-r--r-- | lib/ansible/cli/console.py | 2 | ||||
-rw-r--r-- | lib/ansible/cli/doc.py | 6 | ||||
-rw-r--r-- | lib/ansible/config/base.yml | 93 | ||||
-rw-r--r-- | lib/ansible/constants.py | 2 | ||||
-rw-r--r-- | lib/ansible/executor/powershell/module_manifest.py | 4 | ||||
-rw-r--r-- | lib/ansible/executor/task_queue_manager.py | 12 | ||||
-rw-r--r-- | lib/ansible/modules/copy.py | 4 | ||||
-rw-r--r-- | lib/ansible/modules/unarchive.py | 2 | ||||
-rw-r--r-- | lib/ansible/modules/uri.py | 4 | ||||
-rw-r--r-- | lib/ansible/plugins/callback/junit.py | 2 | ||||
-rw-r--r-- | lib/ansible/plugins/callback/tree.py | 2 | ||||
-rw-r--r-- | lib/ansible/template/safe_eval.py | 4 | ||||
-rw-r--r-- | lib/ansible/utils/display.py | 4 | ||||
-rw-r--r-- | lib/ansible/utils/plugin_docs.py | 2 |
15 files changed, 97 insertions, 48 deletions
diff --git a/lib/ansible/cli/adhoc.py b/lib/ansible/cli/adhoc.py index 28868bc5bf..2090721d01 100644 --- a/lib/ansible/cli/adhoc.py +++ b/lib/ansible/cli/adhoc.py @@ -144,7 +144,7 @@ class AdHocCLI(CLI): run_tree = False if context.CLIARGS['tree']: - C.DEFAULT_CALLBACK_WHITELIST.append('tree') + C.CALLBACKS_ENABLED.append('tree') C.TREE_DIR = context.CLIARGS['tree'] run_tree = True diff --git a/lib/ansible/cli/console.py b/lib/ansible/cli/console.py index ddd6baf120..1be9bd51cd 100644 --- a/lib/ansible/cli/console.py +++ b/lib/ansible/cli/console.py @@ -150,7 +150,7 @@ class ConsoleCLI(CLI, cmd.Cmd): self._find_modules_in_path(module) elif module.startswith('__'): continue - elif any(module.endswith(x) for x in C.BLACKLIST_EXTS): + elif any(module.endswith(x) for x in C.REJECT_EXTS): continue elif module in C.IGNORE_FILES: continue diff --git a/lib/ansible/cli/doc.py b/lib/ansible/cli/doc.py index 41baa79665..82d2d191f8 100644 --- a/lib/ansible/cli/doc.py +++ b/lib/ansible/cli/doc.py @@ -32,7 +32,7 @@ from ansible.utils.collection_loader import AnsibleCollectionConfig from ansible.utils.collection_loader._collection_finder import _get_collection_name_from_path from ansible.utils.display import Display from ansible.utils.plugin_docs import ( - BLACKLIST, + REJECTLIST, remove_current_collection_from_versions_and_dates, get_docstring, get_versioned_doclink, @@ -417,7 +417,7 @@ class DocCLI(CLI): continue elif os.path.isdir(full_path): continue - elif any(plugin.endswith(x) for x in C.BLACKLIST_EXTS): + elif any(plugin.endswith(x) for x in C.REJECT_EXTS): continue elif plugin.startswith('__'): continue @@ -430,7 +430,7 @@ class DocCLI(CLI): plugin = os.path.splitext(plugin)[0] # removes the extension plugin = plugin.lstrip('_') # remove underscore from deprecated plugins - if plugin not in BLACKLIST.get(bkey, ()): + if plugin not in REJECTLIST.get(bkey, ()): if collection: plugin = '%s.%s' % (collection, plugin) diff --git a/lib/ansible/config/base.yml b/lib/ansible/config/base.yml index e5ea6b7799..a3026be2ea 100644 --- a/lib/ansible/config/base.yml +++ b/lib/ansible/config/base.yml @@ -36,15 +36,29 @@ ANSIBLE_COW_SELECTION: env: [{name: ANSIBLE_COW_SELECTION}] ini: - {key: cow_selection, section: defaults} -ANSIBLE_COW_WHITELIST: - name: Cowsay filter whitelist +ANSIBLE_COW_ACCEPTLIST: + name: Cowsay filter acceptance list default: ['bud-frogs', 'bunny', 'cheese', 'daemon', 'default', 'dragon', 'elephant-in-snake', 'elephant', 'eyes', 'hellokitty', 'kitty', 'luke-koala', 'meow', 'milk', 'moofasa', 'moose', 'ren', 'sheep', 'small', 'stegosaurus', 'stimpy', 'supermilker', 'three-eyes', 'turkey', 'turtle', 'tux', 'udder', 'vader-koala', 'vader', 'www'] description: White list of cowsay templates that are 'safe' to use, set to empty list if you want to enable all installed templates. - env: [{name: ANSIBLE_COW_WHITELIST}] + env: + - name: ANSIBLE_COW_WHITELIST + deprecated: + why: Normalizing names to new standard. + version: "2.15" + alternatives: 'ANSIBLE_COW_ACCEPTLIST' + - name: ANSIBLE_COW_ACCEPTLIST + version_added: '2.11' ini: - - {key: cow_whitelist, section: defaults} + - key: cow_whitelist + section: defaults + deprecated: + why: Normalizing names to new standard. + version: "2.15" + alternatives: 'cowsay_enabled_stencils' + - key: cowsay_enabled_stencils + section: defaults + version_added: '2.11' type: list - yaml: {key: display.cowsay_whitelist} ANSIBLE_FORCE_COLOR: name: Force color output default: False @@ -382,7 +396,7 @@ COVERAGE_REMOTE_OUTPUT: - {name: _ansible_coverage_remote_output} type: str version_added: '2.9' -COVERAGE_REMOTE_PATH_FILTER: +COVERAGE_REMOTE_PATHS: name: Sets the list of paths to run coverage for. description: - A list of paths for files on the Ansible controller to run coverage for when executing on the remote host. @@ -392,8 +406,14 @@ COVERAGE_REMOTE_PATH_FILTER: - This is for internal use only. default: '*' env: - - {name: _ANSIBLE_COVERAGE_REMOTE_PATH_FILTER} - type: str + - name: _ANSIBLE_COVERAGE_REMOTE_WHITELIST + deprecated: + why: Normalizing names to new standard. + version: "2.15" + alternatives: '_ANSIBLE_COVERAGE_REMOTE_PATHS' + - name: '_ANSIBLE_COVERAGE_REMOTE_PATHS' + version_added: '2.11' + type: pathlist version_added: '2.9' ACTION_WARNINGS: name: Toggle action warnings @@ -548,13 +568,28 @@ DEFAULT_CACHE_PLUGIN_PATH: ini: - {key: cache_plugins, section: defaults} type: pathspec -DEFAULT_CALLABLE_WHITELIST: - name: Template 'callable' whitelist +CALLABLE_ACCEPT_LIST: + name: Template 'callable' accept list default: [] description: Whitelist of callable methods to be made available to template evaluation - env: [{name: ANSIBLE_CALLABLE_WHITELIST}] + env: + - name: ANSIBLE_CALLABLE_WHITELIST + deprecated: + why: Normalizing names to new standard. + version: "2.15" + alternatives: 'ANSIBLE_CALLABLE_ENABLED' + - name: ANSIBLE_CALLABLE_ENABLED + version_added: '2.11' ini: - - {key: callable_whitelist, section: defaults} + - key: callable_whitelist + section: defaults + deprecated: + why: Normalizing names to new standard. + version: "2.15" + alternatives: 'callable_enabled' + - key: callable_enabled + section: defaults + version_added: '2.11' type: list DEFAULT_CALLBACK_PLUGIN_PATH: name: Callback Plugins Path @@ -565,17 +600,31 @@ DEFAULT_CALLBACK_PLUGIN_PATH: - {key: callback_plugins, section: defaults} type: pathspec yaml: {key: plugins.callback.path} -DEFAULT_CALLBACK_WHITELIST: - name: Callback Whitelist +CALLBACKS_ENABLED: + name: Enable callback plugins that require it. default: [] description: - - "List of whitelisted callbacks, not all callbacks need whitelisting, + - "List of enabled callbacks, not all callbacks need enabling, but many of those shipped with Ansible do as we don't want them activated by default." - env: [{name: ANSIBLE_CALLBACK_WHITELIST}] + env: + - name: ANSIBLE_CALLBACK_WHITELIST + deprecated: + why: Normalizing names to new standard. + version: "2.15" + alternatives: 'ANSIBLE_CALLBACKS_ENABLED' + - name: ANSIBLE_CALLBACKS_ENABLED + version_added: '2.11' ini: - - {key: callback_whitelist, section: defaults} + - key: callback_whitelist + section: defaults + deprecated: + why: Normalizing names to new standard. + version: "2.15" + alternatives: 'callback_enabled' + - key: callbacks_enabled + section: defaults + version_added: '2.11' type: list - yaml: {key: plugins.callback.whitelist} DEFAULT_CLICONF_PLUGIN_PATH: name: Cliconf Plugins Path default: ~/.ansible/plugins/cliconf:/usr/share/ansible/plugins/cliconf @@ -1610,7 +1659,7 @@ INVENTORY_EXPORT: type: bool INVENTORY_IGNORE_EXTS: name: Inventory ignore extensions - default: "{{(BLACKLIST_EXTS + ('.orig', '.ini', '.cfg', '.retry'))}}" + default: "{{(REJECT_EXTS + ('.orig', '.ini', '.cfg', '.retry'))}}" description: List of extensions to ignore when using a directory as an inventory source env: [{name: ANSIBLE_INVENTORY_IGNORE}] ini: @@ -1672,10 +1721,10 @@ INJECT_FACTS_AS_VARS: version_added: "2.5" MODULE_IGNORE_EXTS: name: Module ignore extensions - default: "{{(BLACKLIST_EXTS + ('.yaml', '.yml', '.ini'))}}" + default: "{{(REJECT_EXTS + ('.yaml', '.yml', '.ini'))}}" description: - List of extensions to ignore when looking for modules to load - - This is for blacklisting script and binary module fallback extensions + - This is for rejecting script and binary module fallback extensions env: [{name: ANSIBLE_MODULE_IGNORE_EXTS}] ini: - {key: module_ignore_exts, section: defaults} @@ -1905,7 +1954,7 @@ USE_PERSISTENT_CONNECTIONS: - {key: use_persistent_connections, section: defaults} type: boolean VARIABLE_PLUGINS_ENABLED: - name: Vars plugin whitelist + name: Vars plugin enabled list default: ['host_group_vars'] description: Whitelist for variable plugins that require it. env: [{name: ANSIBLE_VARS_ENABLED}] diff --git a/lib/ansible/constants.py b/lib/ansible/constants.py index 38ae5c8f19..f93986ab4f 100644 --- a/lib/ansible/constants.py +++ b/lib/ansible/constants.py @@ -60,7 +60,7 @@ class _DeprecatedSequenceConstant(Sequence): # CONSTANTS ### yes, actual ones -BLACKLIST_EXTS = ('.pyc', '.pyo', '.swp', '.bak', '~', '.rpm', '.md', '.txt', '.rst') +REJECT_EXTS = ('.pyc', '.pyo', '.swp', '.bak', '~', '.rpm', '.md', '.txt', '.rst') BOOL_TRUE = BOOLEANS_TRUE COLLECTION_PTYPE_COMPAT = {'module': 'modules'} DEFAULT_BECOME_PASS = None diff --git a/lib/ansible/executor/powershell/module_manifest.py b/lib/ansible/executor/powershell/module_manifest.py index 9d7987bbb0..a784d244b0 100644 --- a/lib/ansible/executor/powershell/module_manifest.py +++ b/lib/ansible/executor/powershell/module_manifest.py @@ -340,8 +340,8 @@ def _create_powershell_wrapper(b_module_data, module_path, module_args, finder.scan_exec_script('coverage_wrapper') coverage_manifest['output'] = coverage_output - coverage_path_filter = C.config.get_config_value('COVERAGE_REMOTE_PATH_FILTER', variables=task_vars) - coverage_manifest['path_filter'] = coverage_path_filter + coverage_enabled = C.config.get_config_value('COVERAGE_REMOTE_PATHS', variables=task_vars) + coverage_manifest['path_filter'] = coverage_enabled # make sure Ansible.ModuleUtils.AddType is added if any C# utils are used if len(finder.cs_utils_wrapper) > 0 or len(finder.cs_utils_module) > 0: diff --git a/lib/ansible/executor/task_queue_manager.py b/lib/ansible/executor/task_queue_manager.py index 348132e93d..9b4f51537a 100644 --- a/lib/ansible/executor/task_queue_manager.py +++ b/lib/ansible/executor/task_queue_manager.py @@ -174,8 +174,8 @@ class TaskQueueManager: # get all configured loadable callbacks (adjacent, builtin) callback_list = list(callback_loader.all(class_only=True)) - # add whitelisted callbacks that refer to collections, which might not appear in normal listing - for c in C.DEFAULT_CALLBACK_WHITELIST: + # add enabled callbacks that refer to collections, which might not appear in normal listing + for c in C.CALLBACKS_ENABLED: # load all, as collection ones might be using short/redirected names and not a fqcn plugin = callback_loader.get(c, class_only=True) @@ -191,7 +191,7 @@ class TaskQueueManager: for callback_plugin in callback_list: callback_type = getattr(callback_plugin, 'CALLBACK_TYPE', '') - callback_needs_whitelist = getattr(callback_plugin, 'CALLBACK_NEEDS_WHITELIST', False) + callback_needs_enabled = getattr(callback_plugin, 'CALLBACK_NEEDS_ENABLED', getattr(callback_plugin, 'CALLBACK_NEEDS_WHITELIST', False)) # try to get colleciotn world name first cnames = getattr(callback_plugin, '_redirected_names', []) @@ -212,10 +212,10 @@ class TaskQueueManager: elif callback_name == 'tree' and self._run_tree: # TODO: remove special case for tree, which is an adhoc cli option --tree pass - elif not self._run_additional_callbacks or (callback_needs_whitelist and ( + elif not self._run_additional_callbacks or (callback_needs_enabled and ( # only run if not adhoc, or adhoc was specifically configured to run + check enabled list - C.DEFAULT_CALLBACK_WHITELIST is None or callback_name not in C.DEFAULT_CALLBACK_WHITELIST)): - # 2.x plugins shipped with ansible should require whitelisting, older or non shipped should load automatically + C.CALLBACKS_ENABLED is None or callback_name not in C.CALLBACKS_ENABLED)): + # 2.x plugins shipped with ansible should require enabling, older or non shipped should load automatically continue try: diff --git a/lib/ansible/modules/copy.py b/lib/ansible/modules/copy.py index 0dddb3fff3..65fb622f76 100644 --- a/lib/ansible/modules/copy.py +++ b/lib/ansible/modules/copy.py @@ -86,8 +86,8 @@ options: remote_src: description: - Influence whether C(src) needs to be transferred or already is present remotely. - - If C(no), it will search for C(src) at originating/master machine. - - If C(yes) it will go to the remote/target machine for the C(src). + - If C(no), it will search for C(src) on the controller node. + - If C(yes) it will search for C(src) on the managed (remote) node. - C(remote_src) supports recursive copying as of version 2.8. - C(remote_src) only works with C(mode=preserve) as of version 2.6. type: bool diff --git a/lib/ansible/modules/unarchive.py b/lib/ansible/modules/unarchive.py index 550ca3a00c..7ccd56a0d6 100644 --- a/lib/ansible/modules/unarchive.py +++ b/lib/ansible/modules/unarchive.py @@ -39,7 +39,7 @@ options: required: true copy: description: - - If true, the file is copied from local 'master' to the target machine, otherwise, the plugin will look for src archive at the target machine. + - If true, the file is copied from local controller to the managed (remote) node, otherwise, the plugin will look for src archive on the managed machine. - This option has been deprecated in favor of C(remote_src). - This option is mutually exclusive with C(remote_src). type: bool diff --git a/lib/ansible/modules/uri.py b/lib/ansible/modules/uri.py index abd81ba856..0e8ad802b2 100644 --- a/lib/ansible/modules/uri.py +++ b/lib/ansible/modules/uri.py @@ -149,8 +149,8 @@ options: version_added: '2.7' remote_src: description: - - If C(no), the module will search for src on originating/master machine. - - If C(yes) the module will use the C(src) path on the remote/target machine. + - If C(no), the module will search for the C(src) on the controller node. + - If C(yes), the module will search for the C(src) on the managed (remote) node. type: bool default: no version_added: '2.7' diff --git a/lib/ansible/plugins/callback/junit.py b/lib/ansible/plugins/callback/junit.py index 0b55ce7267..97f0cfd120 100644 --- a/lib/ansible/plugins/callback/junit.py +++ b/lib/ansible/plugins/callback/junit.py @@ -150,7 +150,7 @@ class CallbackModule(CallbackBase): CALLBACK_VERSION = 2.0 CALLBACK_TYPE = 'aggregate' CALLBACK_NAME = 'junit' - CALLBACK_NEEDS_WHITELIST = True + CALLBACK_NEEDS_ENABLED = True def __init__(self): super(CallbackModule, self).__init__() diff --git a/lib/ansible/plugins/callback/tree.py b/lib/ansible/plugins/callback/tree.py index 23892f39a6..e7682d5f17 100644 --- a/lib/ansible/plugins/callback/tree.py +++ b/lib/ansible/plugins/callback/tree.py @@ -44,7 +44,7 @@ class CallbackModule(CallbackBase): CALLBACK_VERSION = 2.0 CALLBACK_TYPE = 'aggregate' CALLBACK_NAME = 'tree' - CALLBACK_NEEDS_WHITELIST = True + CALLBACK_NEEDS_ENABLED = True def set_options(self, task_keys=None, var_options=None, direct=None): ''' override to set self.tree ''' diff --git a/lib/ansible/template/safe_eval.py b/lib/ansible/template/safe_eval.py index 43ce250c98..2c0bfff8f9 100644 --- a/lib/ansible/template/safe_eval.py +++ b/lib/ansible/template/safe_eval.py @@ -112,7 +112,7 @@ def safe_eval(expr, locals=None, include_exceptions=False): for test in test_loader.all(): test_list.extend(test.tests().keys()) - CALL_WHITELIST = C.DEFAULT_CALLABLE_WHITELIST + filter_list + test_list + CALL_ENABLED = C.CALLABLE_ACCEPT_LIST + filter_list + test_list class CleansingNodeVisitor(ast.NodeVisitor): def generic_visit(self, node, inside_call=False): @@ -124,7 +124,7 @@ def safe_eval(expr, locals=None, include_exceptions=False): # Disallow calls to builtin functions that we have not vetted # as safe. Other functions are excluded by setting locals in # the call to eval() later on - if hasattr(builtins, node.id) and node.id not in CALL_WHITELIST: + if hasattr(builtins, node.id) and node.id not in CALL_ENABLED: raise Exception("invalid function: %s" % node.id) # iterate over all child nodes for child_node in ast.iter_child_nodes(node): diff --git a/lib/ansible/utils/display.py b/lib/ansible/utils/display.py index a372b69108..e268a63c9f 100644 --- a/lib/ansible/utils/display.py +++ b/lib/ansible/utils/display.py @@ -226,8 +226,8 @@ class Display(with_metaclass(Singleton, object)): cmd = subprocess.Popen([self.b_cowsay, "-l"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) (out, err) = cmd.communicate() self.cows_available = set([to_text(c) for c in out.split()]) - if C.ANSIBLE_COW_WHITELIST and any(C.ANSIBLE_COW_WHITELIST): - self.cows_available = set(C.ANSIBLE_COW_WHITELIST).intersection(self.cows_available) + if C.ANSIBLE_COW_ACCEPTLIST and any(C.ANSIBLE_COW_ACCEPTLIST): + self.cows_available = set(C.ANSIBLE_COW_ACCEPTLIST).intersection(self.cows_available) except Exception: # could not execute cowsay for some reason self.b_cowsay = False diff --git a/lib/ansible/utils/plugin_docs.py b/lib/ansible/utils/plugin_docs.py index 6522f76e95..7dca58e405 100644 --- a/lib/ansible/utils/plugin_docs.py +++ b/lib/ansible/utils/plugin_docs.py @@ -18,7 +18,7 @@ display = Display() # modules that are ok that they do not have documentation strings -BLACKLIST = { +REJECTLIST = { 'MODULE': frozenset(('async_wrapper',)), 'CACHE': frozenset(('base',)), } |