ansible-core 2.19.0b1__py3-none-any.whl → 2.19.0b3__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.
Files changed (92) hide show
  1. ansible/_internal/_ansiballz.py +1 -4
  2. ansible/_internal/_collection_proxy.py +47 -0
  3. ansible/_internal/_errors/_handler.py +4 -4
  4. ansible/_internal/_json/__init__.py +47 -4
  5. ansible/_internal/_json/_profiles/_legacy.py +2 -3
  6. ansible/_internal/_templating/_datatag.py +3 -4
  7. ansible/_internal/_templating/_engine.py +6 -1
  8. ansible/_internal/_templating/_jinja_bits.py +4 -4
  9. ansible/_internal/_templating/_jinja_plugins.py +7 -17
  10. ansible/cli/__init__.py +12 -5
  11. ansible/cli/arguments/option_helpers.py +4 -1
  12. ansible/cli/doc.py +14 -8
  13. ansible/config/base.yml +17 -20
  14. ansible/config/manager.py +2 -2
  15. ansible/constants.py +0 -62
  16. ansible/errors/__init__.py +6 -2
  17. ansible/executor/module_common.py +11 -7
  18. ansible/executor/process/worker.py +31 -26
  19. ansible/executor/task_executor.py +38 -31
  20. ansible/executor/task_queue_manager.py +62 -52
  21. ansible/executor/task_result.py +168 -72
  22. ansible/galaxy/api.py +1 -1
  23. ansible/galaxy/collection/__init__.py +3 -3
  24. ansible/inventory/manager.py +2 -1
  25. ansible/module_utils/_internal/_ansiballz.py +4 -30
  26. ansible/module_utils/_internal/_datatag/_tags.py +3 -25
  27. ansible/module_utils/_internal/_deprecator.py +134 -0
  28. ansible/module_utils/_internal/_plugin_info.py +25 -0
  29. ansible/module_utils/_internal/_validation.py +14 -0
  30. ansible/module_utils/ansible_release.py +1 -1
  31. ansible/module_utils/basic.py +68 -23
  32. ansible/module_utils/common/arg_spec.py +8 -3
  33. ansible/module_utils/common/messages.py +40 -23
  34. ansible/module_utils/common/process.py +0 -1
  35. ansible/module_utils/common/respawn.py +0 -7
  36. ansible/module_utils/common/warnings.py +13 -13
  37. ansible/module_utils/datatag.py +13 -13
  38. ansible/modules/async_status.py +1 -1
  39. ansible/modules/dnf5.py +1 -1
  40. ansible/modules/get_url.py +1 -1
  41. ansible/parsing/utils/jsonify.py +40 -0
  42. ansible/parsing/yaml/objects.py +16 -5
  43. ansible/playbook/included_file.py +25 -12
  44. ansible/playbook/task.py +0 -2
  45. ansible/plugins/__init__.py +18 -8
  46. ansible/plugins/action/__init__.py +6 -14
  47. ansible/plugins/action/gather_facts.py +2 -4
  48. ansible/plugins/callback/__init__.py +173 -86
  49. ansible/plugins/callback/default.py +79 -79
  50. ansible/plugins/callback/junit.py +20 -19
  51. ansible/plugins/callback/minimal.py +17 -17
  52. ansible/plugins/callback/oneline.py +23 -16
  53. ansible/plugins/callback/tree.py +13 -6
  54. ansible/plugins/connection/local.py +1 -1
  55. ansible/plugins/connection/paramiko_ssh.py +9 -2
  56. ansible/plugins/doc_fragments/action_core.py +1 -1
  57. ansible/plugins/filter/core.py +12 -2
  58. ansible/plugins/inventory/__init__.py +2 -2
  59. ansible/plugins/loader.py +194 -130
  60. ansible/plugins/lookup/url.py +2 -2
  61. ansible/plugins/strategy/__init__.py +76 -82
  62. ansible/plugins/strategy/free.py +4 -4
  63. ansible/plugins/strategy/linear.py +11 -9
  64. ansible/plugins/test/core.py +1 -1
  65. ansible/release.py +1 -1
  66. ansible/template/__init__.py +8 -6
  67. ansible/utils/collection_loader/_collection_meta.py +5 -3
  68. ansible/utils/display.py +141 -79
  69. ansible/utils/py3compat.py +1 -7
  70. ansible/utils/ssh_functions.py +4 -1
  71. ansible/utils/vars.py +23 -0
  72. ansible/vars/clean.py +1 -1
  73. ansible/vars/manager.py +18 -27
  74. ansible/vars/plugins.py +4 -4
  75. {ansible_core-2.19.0b1.dist-info → ansible_core-2.19.0b3.dist-info}/METADATA +1 -1
  76. {ansible_core-2.19.0b1.dist-info → ansible_core-2.19.0b3.dist-info}/RECORD +89 -85
  77. ansible_test/_internal/commands/sanity/pylint.py +1 -0
  78. ansible_test/_internal/docker_util.py +4 -3
  79. ansible_test/_util/controller/sanity/pylint/plugins/deprecated_calls.py +475 -0
  80. ansible_test/_util/controller/sanity/pylint/plugins/deprecated_comment.py +137 -0
  81. ansible/module_utils/_internal/_dataclass_annotation_patch.py +0 -64
  82. ansible/module_utils/_internal/_plugin_exec_context.py +0 -49
  83. ansible_test/_util/controller/sanity/pylint/plugins/deprecated.py +0 -399
  84. {ansible_core-2.19.0b1.dist-info → ansible_core-2.19.0b3.dist-info}/Apache-License.txt +0 -0
  85. {ansible_core-2.19.0b1.dist-info → ansible_core-2.19.0b3.dist-info}/BSD-3-Clause.txt +0 -0
  86. {ansible_core-2.19.0b1.dist-info → ansible_core-2.19.0b3.dist-info}/COPYING +0 -0
  87. {ansible_core-2.19.0b1.dist-info → ansible_core-2.19.0b3.dist-info}/MIT-license.txt +0 -0
  88. {ansible_core-2.19.0b1.dist-info → ansible_core-2.19.0b3.dist-info}/PSF-license.txt +0 -0
  89. {ansible_core-2.19.0b1.dist-info → ansible_core-2.19.0b3.dist-info}/WHEEL +0 -0
  90. {ansible_core-2.19.0b1.dist-info → ansible_core-2.19.0b3.dist-info}/entry_points.txt +0 -0
  91. {ansible_core-2.19.0b1.dist-info → ansible_core-2.19.0b3.dist-info}/simplified_bsd.txt +0 -0
  92. {ansible_core-2.19.0b1.dist-info → ansible_core-2.19.0b3.dist-info}/top_level.txt +0 -0
ansible/playbook/task.py CHANGED
@@ -227,8 +227,6 @@ class Task(Base, Conditional, Taggable, CollectionSearch, Notifiable, Delegatabl
227
227
  raise AnsibleError("you must specify a value when using %s" % k, obj=ds)
228
228
  new_ds['loop_with'] = loop_name
229
229
  new_ds['loop'] = v
230
- # display.deprecated("with_ type loops are being phased out, use the 'loop' keyword instead",
231
- # version="2.10", collection_name='ansible.builtin')
232
230
 
233
231
  def preprocess_data(self, ds):
234
232
  """
@@ -20,24 +20,26 @@
20
20
  from __future__ import annotations
21
21
 
22
22
  import abc
23
+ import functools
23
24
  import types
24
25
  import typing as t
25
26
 
26
27
  from ansible import constants as C
27
28
  from ansible.errors import AnsibleError
28
29
  from ansible.utils.display import Display
30
+ from ansible.utils import display as _display
29
31
 
30
- from ansible.module_utils._internal import _plugin_exec_context
32
+ from ansible.module_utils._internal import _plugin_info
31
33
 
32
34
  display = Display()
33
35
 
34
36
  if t.TYPE_CHECKING:
35
- from .loader import PluginPathContext
37
+ from . import loader as _t_loader
36
38
 
37
39
  # Global so that all instances of a PluginLoader will share the caches
38
40
  MODULE_CACHE = {} # type: dict[str, dict[str, types.ModuleType]]
39
- PATH_CACHE = {} # type: dict[str, list[PluginPathContext] | None]
40
- PLUGIN_PATH_CACHE = {} # type: dict[str, dict[str, dict[str, PluginPathContext]]]
41
+ PATH_CACHE = {} # type: dict[str, list[_t_loader.PluginPathContext] | None]
42
+ PLUGIN_PATH_CACHE = {} # type: dict[str, dict[str, dict[str, _t_loader.PluginPathContext]]]
41
43
 
42
44
 
43
45
  def get_plugin_class(obj):
@@ -50,10 +52,10 @@ def get_plugin_class(obj):
50
52
  class _ConfigurablePlugin(t.Protocol):
51
53
  """Protocol to provide type-safe access to config for plugin-related mixins."""
52
54
 
53
- def get_option(self, option: str, hostvars: dict[str, object] | None = None) -> object: ...
55
+ def get_option(self, option: str, hostvars: dict[str, object] | None = None) -> t.Any: ...
54
56
 
55
57
 
56
- class _AnsiblePluginInfoMixin(_plugin_exec_context.HasPluginInfo):
58
+ class _AnsiblePluginInfoMixin(_plugin_info.HasPluginInfo):
57
59
  """Mixin to provide type annotations and default values for existing PluginLoader-set load-time attrs."""
58
60
  _original_path: str | None = None
59
61
  _load_name: str | None = None
@@ -102,6 +104,14 @@ class AnsiblePlugin(_AnsiblePluginInfoMixin, _ConfigurablePlugin, metaclass=abc.
102
104
  raise KeyError(str(e))
103
105
  return option_value, origin
104
106
 
107
+ @functools.cached_property
108
+ def __plugin_info(self):
109
+ """
110
+ Internal cached property to retrieve `PluginInfo` for this plugin instance.
111
+ Only for use by the `AnsiblePlugin` base class.
112
+ """
113
+ return _plugin_info.get_plugin_info(self)
114
+
105
115
  def get_option(self, option, hostvars=None):
106
116
 
107
117
  if option not in self._options:
@@ -117,7 +127,7 @@ class AnsiblePlugin(_AnsiblePluginInfoMixin, _ConfigurablePlugin, metaclass=abc.
117
127
 
118
128
  def set_option(self, option, value):
119
129
  self._options[option] = C.config.get_config_value(option, plugin_type=self.plugin_type, plugin_name=self._load_name, direct={option: value})
120
- C.handle_config_noise(display)
130
+ _display._report_config_warnings(self.__plugin_info)
121
131
 
122
132
  def set_options(self, task_keys=None, var_options=None, direct=None):
123
133
  """
@@ -134,7 +144,7 @@ class AnsiblePlugin(_AnsiblePluginInfoMixin, _ConfigurablePlugin, metaclass=abc.
134
144
  if self.allow_extras and var_options and '_extras' in var_options:
135
145
  # these are largely unvalidated passthroughs, either plugin or underlying API will validate
136
146
  self._options['_extras'] = var_options['_extras']
137
- C.handle_config_noise(display)
147
+ _display._report_config_warnings(self.__plugin_info)
138
148
 
139
149
  def has_option(self, option):
140
150
  if not self._options:
@@ -318,13 +318,6 @@ class ActionBase(ABC, _AnsiblePluginInfoMixin):
318
318
  final_environment: dict[str, t.Any] = {}
319
319
  self._compute_environment_string(final_environment)
320
320
 
321
- # `modify_module` adapts PluginInfo to allow target-side use of `PluginExecContext` since modules aren't plugins
322
- plugin = PluginInfo(
323
- requested_name=module_name,
324
- resolved_name=result.resolved_fqcn,
325
- type='module',
326
- )
327
-
328
321
  # modify_module will exit early if interpreter discovery is required; re-run after if necessary
329
322
  for _dummy in (1, 2):
330
323
  try:
@@ -338,7 +331,6 @@ class ActionBase(ABC, _AnsiblePluginInfoMixin):
338
331
  async_timeout=self._task.async_val,
339
332
  environment=final_environment,
340
333
  remote_is_local=bool(getattr(self._connection, '_remote_is_local', False)),
341
- plugin=plugin,
342
334
  become_plugin=self._connection.become,
343
335
  )
344
336
 
@@ -649,12 +641,12 @@ class ActionBase(ABC, _AnsiblePluginInfoMixin):
649
641
  # done. Make the files +x if we're asked to, and return.
650
642
  if not self._is_become_unprivileged():
651
643
  if execute:
652
- # Can't depend on the file being transferred with execute permissions.
644
+ # Can't depend on the file being transferred with required permissions.
653
645
  # Only need user perms because no become was used here
654
- res = self._remote_chmod(remote_paths, 'u+x')
646
+ res = self._remote_chmod(remote_paths, 'u+rwx')
655
647
  if res['rc'] != 0:
656
648
  raise AnsibleError(
657
- 'Failed to set execute bit on remote files '
649
+ 'Failed to set permissions on remote files '
658
650
  '(rc: {0}, err: {1})'.format(
659
651
  res['rc'],
660
652
  to_native(res['stderr'])))
@@ -695,10 +687,10 @@ class ActionBase(ABC, _AnsiblePluginInfoMixin):
695
687
  return remote_paths
696
688
 
697
689
  # Step 3b: Set execute if we need to. We do this before anything else
698
- # because some of the methods below might work but not let us set +x
699
- # as part of them.
690
+ # because some of the methods below might work but not let us set
691
+ # permissions as part of them.
700
692
  if execute:
701
- res = self._remote_chmod(remote_paths, 'u+x')
693
+ res = self._remote_chmod(remote_paths, 'u+rwx')
702
694
  if res['rc'] != 0:
703
695
  raise AnsibleError(
704
696
  'Failed to set file mode or acl on remote temporary files '
@@ -28,10 +28,8 @@ class ActionModule(ActionBase):
28
28
 
29
29
  # TODO: remove in favor of controller side argspec detecting valid arguments
30
30
  # network facts modules must support gather_subset
31
- try:
32
- name = self._connection.ansible_name.removeprefix('ansible.netcommon.')
33
- except AttributeError:
34
- name = self._connection._load_name.split('.')[-1]
31
+ name = self._connection.ansible_name.removeprefix('ansible.netcommon.')
32
+
35
33
  if name not in ('network_cli', 'httpapi', 'netconf'):
36
34
  subset = mod_args.pop('gather_subset', None)
37
35
  if subset not in ('all', ['all'], None):