ansible-core 2.19.0b2__py3-none-any.whl → 2.19.0b4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ansible/_internal/__init__.py +1 -1
- ansible/_internal/_ansiballz.py +1 -4
- ansible/_internal/_json/__init__.py +1 -1
- ansible/_internal/_templating/_datatag.py +3 -4
- ansible/_internal/_templating/_engine.py +6 -1
- ansible/_internal/_templating/_jinja_plugins.py +2 -6
- ansible/_internal/_testing.py +26 -0
- ansible/cli/__init__.py +3 -2
- ansible/cli/arguments/option_helpers.py +10 -3
- ansible/cli/doc.py +0 -1
- ansible/config/base.yml +5 -23
- ansible/config/manager.py +144 -103
- ansible/constants.py +1 -63
- ansible/errors/__init__.py +6 -2
- ansible/executor/module_common.py +11 -7
- ansible/executor/task_executor.py +6 -8
- ansible/galaxy/api.py +1 -1
- ansible/galaxy/collection/__init__.py +3 -3
- ansible/inventory/manager.py +1 -0
- ansible/module_utils/_internal/_ansiballz.py +4 -30
- ansible/module_utils/_internal/_datatag/_tags.py +3 -25
- ansible/module_utils/_internal/_deprecator.py +134 -0
- ansible/module_utils/_internal/_plugin_info.py +25 -0
- ansible/module_utils/_internal/_validation.py +14 -0
- ansible/module_utils/ansible_release.py +1 -1
- ansible/module_utils/basic.py +64 -17
- ansible/module_utils/common/arg_spec.py +8 -3
- ansible/module_utils/common/messages.py +40 -23
- ansible/module_utils/common/process.py +0 -1
- ansible/module_utils/common/respawn.py +0 -7
- ansible/module_utils/common/warnings.py +13 -13
- ansible/module_utils/datatag.py +13 -13
- ansible/module_utils/facts/virtual/linux.py +1 -1
- ansible/module_utils/parsing/convert_bool.py +6 -0
- ansible/modules/assemble.py +4 -4
- ansible/modules/async_status.py +1 -1
- ansible/modules/cron.py +3 -5
- ansible/modules/dnf5.py +2 -1
- ansible/modules/get_url.py +1 -1
- ansible/modules/git.py +1 -6
- ansible/modules/pip.py +2 -4
- ansible/modules/sysvinit.py +3 -3
- ansible/playbook/task.py +0 -2
- ansible/plugins/__init__.py +18 -8
- ansible/plugins/action/__init__.py +7 -15
- ansible/plugins/action/gather_facts.py +2 -4
- ansible/plugins/action/template.py +3 -0
- ansible/plugins/callback/oneline.py +7 -1
- ansible/plugins/callback/tree.py +7 -1
- ansible/plugins/connection/local.py +1 -1
- ansible/plugins/connection/paramiko_ssh.py +9 -2
- ansible/plugins/doc_fragments/action_core.py +1 -1
- ansible/plugins/filter/core.py +4 -1
- ansible/plugins/inventory/__init__.py +2 -2
- ansible/plugins/loader.py +197 -132
- ansible/plugins/lookup/url.py +2 -2
- ansible/plugins/strategy/__init__.py +6 -6
- ansible/release.py +1 -1
- ansible/template/__init__.py +1 -1
- ansible/utils/collection_loader/__init__.py +2 -0
- ansible/utils/collection_loader/_collection_meta.py +5 -3
- ansible/utils/display.py +137 -71
- ansible/utils/plugin_docs.py +2 -1
- ansible/utils/py3compat.py +1 -7
- ansible/utils/ssh_functions.py +4 -1
- ansible/vars/manager.py +18 -10
- ansible/vars/plugins.py +4 -4
- {ansible_core-2.19.0b2.dist-info → ansible_core-2.19.0b4.dist-info}/METADATA +3 -2
- {ansible_core-2.19.0b2.dist-info → ansible_core-2.19.0b4.dist-info}/RECORD +82 -79
- {ansible_core-2.19.0b2.dist-info → ansible_core-2.19.0b4.dist-info}/WHEEL +1 -1
- ansible_test/_internal/commands/sanity/pylint.py +1 -0
- ansible_test/_internal/docker_util.py +4 -3
- ansible_test/_util/controller/sanity/pylint/plugins/deprecated_calls.py +486 -0
- ansible_test/_util/controller/sanity/pylint/plugins/deprecated_comment.py +137 -0
- ansible/module_utils/_internal/_dataclass_annotation_patch.py +0 -64
- ansible/module_utils/_internal/_plugin_exec_context.py +0 -49
- ansible_test/_util/controller/sanity/pylint/plugins/deprecated.py +0 -399
- {ansible_core-2.19.0b2.dist-info → ansible_core-2.19.0b4.dist-info}/entry_points.txt +0 -0
- {ansible_core-2.19.0b2.dist-info → ansible_core-2.19.0b4.dist-info/licenses}/COPYING +0 -0
- {ansible_core-2.19.0b2.dist-info → ansible_core-2.19.0b4.dist-info/licenses/licenses}/Apache-License.txt +0 -0
- {ansible_core-2.19.0b2.dist-info → ansible_core-2.19.0b4.dist-info/licenses/licenses}/BSD-3-Clause.txt +0 -0
- {ansible_core-2.19.0b2.dist-info → ansible_core-2.19.0b4.dist-info/licenses/licenses}/MIT-license.txt +0 -0
- {ansible_core-2.19.0b2.dist-info → ansible_core-2.19.0b4.dist-info/licenses/licenses}/PSF-license.txt +0 -0
- {ansible_core-2.19.0b2.dist-info → ansible_core-2.19.0b4.dist-info/licenses/licenses}/simplified_bsd.txt +0 -0
- {ansible_core-2.19.0b2.dist-info → ansible_core-2.19.0b4.dist-info}/top_level.txt +0 -0
ansible/_internal/__init__.py
CHANGED
@@ -18,7 +18,7 @@ def get_controller_serialize_map() -> dict[type, t.Callable]:
|
|
18
18
|
return {
|
19
19
|
_lazy_containers._AnsibleLazyTemplateDict: _profiles._JSONSerializationProfile.discard_tags,
|
20
20
|
_lazy_containers._AnsibleLazyTemplateList: _profiles._JSONSerializationProfile.discard_tags,
|
21
|
-
EncryptedString: str, # preserves tags since this is an
|
21
|
+
EncryptedString: str, # preserves tags since this is an instance of EncryptedString; if tags should be discarded from str, another entry will handle it
|
22
22
|
}
|
23
23
|
|
24
24
|
|
ansible/_internal/_ansiballz.py
CHANGED
@@ -42,7 +42,6 @@ def _ansiballz_main(
|
|
42
42
|
module_fqn: str,
|
43
43
|
params: str,
|
44
44
|
profile: str,
|
45
|
-
plugin_info_dict: dict[str, object],
|
46
45
|
date_time: datetime.datetime,
|
47
46
|
coverage_config: str | None,
|
48
47
|
coverage_output: str | None,
|
@@ -142,7 +141,6 @@ def _ansiballz_main(
|
|
142
141
|
run_module(
|
143
142
|
json_params=json_params,
|
144
143
|
profile=profile,
|
145
|
-
plugin_info_dict=plugin_info_dict,
|
146
144
|
module_fqn=module_fqn,
|
147
145
|
modlib_path=modlib_path,
|
148
146
|
coverage_config=coverage_config,
|
@@ -230,13 +228,12 @@ def _ansiballz_main(
|
|
230
228
|
run_module(
|
231
229
|
json_params=json_params,
|
232
230
|
profile=profile,
|
233
|
-
plugin_info_dict=plugin_info_dict,
|
234
231
|
module_fqn=module_fqn,
|
235
232
|
modlib_path=modlib_path,
|
236
233
|
)
|
237
234
|
|
238
235
|
else:
|
239
|
-
print('
|
236
|
+
print(f'FATAL: Unknown debug command {command!r}. Doing nothing.')
|
240
237
|
|
241
238
|
#
|
242
239
|
# See comments in the debug() method for information on debugging
|
@@ -152,7 +152,7 @@ class AnsibleVariableVisitor:
|
|
152
152
|
result: _T
|
153
153
|
|
154
154
|
# DTFIX-RELEASE: the visitor is ignoring dict/mapping keys except for debugging and schema-aware checking, it should be doing type checks on keys
|
155
|
-
# keep in mind the allowed types for keys is a more restrictive set than for values (str and
|
155
|
+
# keep in mind the allowed types for keys is a more restrictive set than for values (str and tagged str only, not EncryptedString)
|
156
156
|
# DTFIX-RELEASE: some type lists being consulted (the ones from datatag) are probably too permissive, and perhaps should not be dynamic
|
157
157
|
|
158
158
|
if (result := self._early_visit(value, value_type)) is not _sentinel:
|
@@ -12,7 +12,6 @@ from ansible.utils.display import Display
|
|
12
12
|
from ._access import NotifiableAccessContextBase
|
13
13
|
from ._utils import TemplateContext
|
14
14
|
|
15
|
-
|
16
15
|
display = Display()
|
17
16
|
|
18
17
|
|
@@ -57,10 +56,10 @@ class DeprecatedAccessAuditContext(NotifiableAccessContextBase):
|
|
57
56
|
display._deprecated_with_plugin_info(
|
58
57
|
msg=msg,
|
59
58
|
help_text=item.deprecated.help_text,
|
60
|
-
version=item.deprecated.
|
61
|
-
date=item.deprecated.
|
59
|
+
version=item.deprecated.version,
|
60
|
+
date=item.deprecated.date,
|
62
61
|
obj=item.template,
|
63
|
-
|
62
|
+
deprecator=item.deprecated.deprecator,
|
64
63
|
)
|
65
64
|
|
66
65
|
return result
|
@@ -566,7 +566,12 @@ class TemplateEngine:
|
|
566
566
|
)
|
567
567
|
|
568
568
|
if _TemplateConfig.allow_broken_conditionals:
|
569
|
-
_display.deprecated(
|
569
|
+
_display.deprecated(
|
570
|
+
msg=msg,
|
571
|
+
obj=conditional,
|
572
|
+
help_text=self._BROKEN_CONDITIONAL_ALLOWED_FRAGMENT,
|
573
|
+
version='2.23',
|
574
|
+
)
|
570
575
|
|
571
576
|
return bool_result
|
572
577
|
|
@@ -9,7 +9,6 @@ import functools
|
|
9
9
|
import typing as t
|
10
10
|
|
11
11
|
from ansible.module_utils._internal._ambient_context import AmbientContextBase
|
12
|
-
from ansible.module_utils._internal._plugin_exec_context import PluginExecContext
|
13
12
|
from ansible.module_utils.common.collections import is_sequence
|
14
13
|
from ansible.module_utils._internal._datatag import AnsibleTagHelper
|
15
14
|
from ansible._internal._datatag._tags import TrustedAsTemplate
|
@@ -111,7 +110,7 @@ class JinjaPluginIntercept(c.MutableMapping):
|
|
111
110
|
return first_marker
|
112
111
|
|
113
112
|
try:
|
114
|
-
with JinjaCallContext(accept_lazy_markers=instance.accept_lazy_markers)
|
113
|
+
with JinjaCallContext(accept_lazy_markers=instance.accept_lazy_markers):
|
115
114
|
return instance.j2_function(*lazify_container_args(args), **lazify_container_kwargs(kwargs))
|
116
115
|
except MarkerError as ex:
|
117
116
|
return ex.source
|
@@ -212,10 +211,7 @@ def _invoke_lookup(*, plugin_name: str, lookup_terms: list, lookup_kwargs: dict[
|
|
212
211
|
wantlist = lookup_kwargs.pop('wantlist', False)
|
213
212
|
errors = lookup_kwargs.pop('errors', 'strict')
|
214
213
|
|
215
|
-
with (
|
216
|
-
JinjaCallContext(accept_lazy_markers=instance.accept_lazy_markers),
|
217
|
-
PluginExecContext(executing_plugin=instance),
|
218
|
-
):
|
214
|
+
with JinjaCallContext(accept_lazy_markers=instance.accept_lazy_markers):
|
219
215
|
try:
|
220
216
|
if _TemplateConfig.allow_embedded_templates:
|
221
217
|
# for backwards compat, only trust constant templates in lookup terms
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"""
|
2
|
+
Testing utilities for use in integration tests, not unit tests or non-test code.
|
3
|
+
Provides better error behavior than Python's `assert` statement.
|
4
|
+
"""
|
5
|
+
|
6
|
+
from __future__ import annotations
|
7
|
+
|
8
|
+
import contextlib
|
9
|
+
import typing as t
|
10
|
+
|
11
|
+
|
12
|
+
class _Checker:
|
13
|
+
@staticmethod
|
14
|
+
def check(value: object, msg: str | None = 'Value is not truthy.') -> None:
|
15
|
+
"""Raise an `AssertionError` if the given `value` is not truthy."""
|
16
|
+
if not value:
|
17
|
+
raise AssertionError(msg)
|
18
|
+
|
19
|
+
|
20
|
+
@contextlib.contextmanager
|
21
|
+
def hard_fail_context(msg: str) -> t.Generator[_Checker]:
|
22
|
+
"""Enter a context which converts all exceptions to `BaseException` and provides a `Checker` instance for making assertions."""
|
23
|
+
try:
|
24
|
+
yield _Checker()
|
25
|
+
except BaseException as ex:
|
26
|
+
raise BaseException(f"Hard failure: {msg}") from ex
|
ansible/cli/__init__.py
CHANGED
@@ -10,7 +10,6 @@ import os
|
|
10
10
|
import signal
|
11
11
|
import sys
|
12
12
|
|
13
|
-
|
14
13
|
# We overload the ``ansible`` adhoc command to provide the functionality for
|
15
14
|
# ``SSH_ASKPASS``. This code is here, and not in ``adhoc.py`` to bypass
|
16
15
|
# unnecessary code. The program provided to ``SSH_ASKPASS`` can only be invoked
|
@@ -106,6 +105,7 @@ except Exception as ex:
|
|
106
105
|
|
107
106
|
|
108
107
|
from ansible import context
|
108
|
+
from ansible.utils import display as _display
|
109
109
|
from ansible.cli.arguments import option_helpers as opt_help
|
110
110
|
from ansible.inventory.manager import InventoryManager
|
111
111
|
from ansible.module_utils.six import string_types
|
@@ -122,6 +122,7 @@ from ansible.utils.collection_loader import AnsibleCollectionConfig
|
|
122
122
|
from ansible.utils.collection_loader._collection_finder import _get_collection_name_from_path
|
123
123
|
from ansible.utils.path import unfrackpath
|
124
124
|
from ansible.vars.manager import VariableManager
|
125
|
+
from ansible.module_utils._internal import _deprecator
|
125
126
|
|
126
127
|
try:
|
127
128
|
import argcomplete
|
@@ -257,7 +258,7 @@ class CLI(ABC):
|
|
257
258
|
else:
|
258
259
|
display.v(u"No config file found; using defaults")
|
259
260
|
|
260
|
-
|
261
|
+
_display._report_config_warnings(_deprecator.ANSIBLE_CORE_DEPRECATOR)
|
261
262
|
|
262
263
|
@staticmethod
|
263
264
|
def split_vault_id(vault_id):
|
@@ -56,7 +56,10 @@ class DeprecatedArgument:
|
|
56
56
|
|
57
57
|
from ansible.utils.display import Display
|
58
58
|
|
59
|
-
Display().deprecated(
|
59
|
+
Display().deprecated( # pylint: disable=ansible-invalid-deprecated-version
|
60
|
+
msg=f'The {option!r} argument is deprecated.',
|
61
|
+
version=self.version,
|
62
|
+
)
|
60
63
|
|
61
64
|
|
62
65
|
class ArgumentParser(argparse.ArgumentParser):
|
@@ -532,13 +535,17 @@ def _tagged_type_factory(name: str, func: t.Callable[[str], object], /) -> t.Cal
|
|
532
535
|
def tag_value(value: str) -> object:
|
533
536
|
result = func(value)
|
534
537
|
|
535
|
-
if result is value:
|
538
|
+
if result is value or func is str:
|
536
539
|
# Values which are not mutated are automatically trusted for templating.
|
537
540
|
# The `is` reference equality is critically important, as other types may only alter the tags, so object equality is
|
538
541
|
# not sufficient to prevent them being tagged as trusted when they should not.
|
542
|
+
# Explicitly include all usages using the `str` type factory since it strips tags.
|
539
543
|
result = TrustedAsTemplate().tag(result)
|
540
544
|
|
541
|
-
|
545
|
+
if not (origin := Origin.get_tag(value)):
|
546
|
+
origin = Origin(description=f'<CLI option {name!r}>')
|
547
|
+
|
548
|
+
return origin.tag(result)
|
542
549
|
|
543
550
|
tag_value._name = name # simplify debugging by attaching the argument name to the function
|
544
551
|
|
ansible/cli/doc.py
CHANGED
@@ -1335,7 +1335,6 @@ class DocCLI(CLI, RoleMixin):
|
|
1335
1335
|
'This was unintentionally allowed when plugin attributes were added, '
|
1336
1336
|
'but the feature does not map well to role argument specs.',
|
1337
1337
|
version='2.20',
|
1338
|
-
collection_name='ansible.builtin',
|
1339
1338
|
)
|
1340
1339
|
text.append("")
|
1341
1340
|
text.append(_format("ATTRIBUTES:", 'bold'))
|
ansible/config/base.yml
CHANGED
@@ -757,7 +757,7 @@ DEFAULT_HASH_BEHAVIOUR:
|
|
757
757
|
- {key: hash_behaviour, section: defaults}
|
758
758
|
DEFAULT_HOST_LIST:
|
759
759
|
name: Inventory Source
|
760
|
-
default: /etc/ansible/hosts
|
760
|
+
default: [/etc/ansible/hosts]
|
761
761
|
description: Comma-separated list of Ansible inventory sources
|
762
762
|
env:
|
763
763
|
- name: ANSIBLE_INVENTORY
|
@@ -1054,7 +1054,7 @@ DEFAULT_ROLES_PATH:
|
|
1054
1054
|
yaml: {key: defaults.roles_path}
|
1055
1055
|
DEFAULT_SELINUX_SPECIAL_FS:
|
1056
1056
|
name: Problematic file systems
|
1057
|
-
default: fuse, nfs, vboxsf, ramfs, 9p, vfat
|
1057
|
+
default: [fuse, nfs, vboxsf, ramfs, 9p, vfat]
|
1058
1058
|
description:
|
1059
1059
|
- "Some filesystems do not support safe operations and/or return inconsistent errors,
|
1060
1060
|
this setting makes Ansible 'tolerate' those in the list without causing fatal errors."
|
@@ -1199,15 +1199,6 @@ DEFAULT_VARS_PLUGIN_PATH:
|
|
1199
1199
|
ini:
|
1200
1200
|
- {key: vars_plugins, section: defaults}
|
1201
1201
|
type: pathspec
|
1202
|
-
# TODO: unused?
|
1203
|
-
#DEFAULT_VAR_COMPRESSION_LEVEL:
|
1204
|
-
# default: 0
|
1205
|
-
# description: 'TODO: write it'
|
1206
|
-
# env: [{name: ANSIBLE_VAR_COMPRESSION_LEVEL}]
|
1207
|
-
# ini:
|
1208
|
-
# - {key: var_compression_level, section: defaults}
|
1209
|
-
# type: integer
|
1210
|
-
# yaml: {key: defaults.var_compression_level}
|
1211
1202
|
DEFAULT_VAULT_ID_MATCH:
|
1212
1203
|
name: Force vault id match
|
1213
1204
|
default: False
|
@@ -1333,7 +1324,7 @@ DISPLAY_SKIPPED_HOSTS:
|
|
1333
1324
|
type: boolean
|
1334
1325
|
DISPLAY_TRACEBACK:
|
1335
1326
|
name: Control traceback display
|
1336
|
-
default: never
|
1327
|
+
default: [never]
|
1337
1328
|
description: When to include tracebacks in extended error messages
|
1338
1329
|
env:
|
1339
1330
|
- name: ANSIBLE_DISPLAY_TRACEBACK
|
@@ -1480,15 +1471,6 @@ GALAXY_COLLECTIONS_PATH_WARNING:
|
|
1480
1471
|
ini:
|
1481
1472
|
- {key: collections_path_warning, section: galaxy}
|
1482
1473
|
version_added: "2.16"
|
1483
|
-
# TODO: unused?
|
1484
|
-
#GALAXY_SCMS:
|
1485
|
-
# name: Galaxy SCMS
|
1486
|
-
# default: git, hg
|
1487
|
-
# description: Available galaxy source control management systems.
|
1488
|
-
# env: [{name: ANSIBLE_GALAXY_SCMS}]
|
1489
|
-
# ini:
|
1490
|
-
# - {key: scms, section: galaxy}
|
1491
|
-
# type: list
|
1492
1474
|
GALAXY_SERVER:
|
1493
1475
|
default: https://galaxy.ansible.com
|
1494
1476
|
description: "URL to prepend when roles don't specify the full URI, assume they are referencing this server as the source."
|
@@ -1731,7 +1713,7 @@ INVENTORY_EXPORT:
|
|
1731
1713
|
type: bool
|
1732
1714
|
INVENTORY_IGNORE_EXTS:
|
1733
1715
|
name: Inventory ignore extensions
|
1734
|
-
default: "{{
|
1716
|
+
default: "{{ REJECT_EXTS + ['.orig', '.cfg', '.retry'] }}"
|
1735
1717
|
description: List of extensions to ignore when using a directory as an inventory source.
|
1736
1718
|
env: [{name: ANSIBLE_INVENTORY_IGNORE}]
|
1737
1719
|
ini:
|
@@ -1788,7 +1770,7 @@ INJECT_FACTS_AS_VARS:
|
|
1788
1770
|
version_added: "2.5"
|
1789
1771
|
MODULE_IGNORE_EXTS:
|
1790
1772
|
name: Module ignore extensions
|
1791
|
-
default: "{{
|
1773
|
+
default: "{{ REJECT_EXTS + ['.yaml', '.yml', '.ini'] }}"
|
1792
1774
|
description:
|
1793
1775
|
- List of extensions to ignore when looking for modules to load.
|
1794
1776
|
- This is for rejecting script and binary module fallback extensions.
|