ansible-core 2.15.4rc1__py3-none-any.whl → 2.16.0b2__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.

Potentially problematic release.


This version of ansible-core might be problematic. Click here for more details.

Files changed (427) hide show
  1. ansible/cli/__init__.py +3 -3
  2. ansible/cli/adhoc.py +1 -1
  3. ansible/cli/arguments/option_helpers.py +15 -5
  4. ansible/cli/config.py +2 -2
  5. ansible/cli/console.py +21 -17
  6. ansible/cli/doc.py +8 -9
  7. ansible/cli/galaxy.py +60 -27
  8. ansible/cli/inventory.py +1 -1
  9. ansible/cli/playbook.py +1 -1
  10. ansible/cli/pull.py +2 -2
  11. ansible/cli/scripts/ansible_connection_cli_stub.py +1 -1
  12. ansible/cli/vault.py +11 -6
  13. ansible/collections/__init__.py +0 -29
  14. ansible/collections/list.py +23 -44
  15. ansible/config/ansible_builtin_runtime.yml +8 -4
  16. ansible/config/base.yml +34 -22
  17. ansible/config/manager.py +1 -1
  18. ansible/constants.py +3 -5
  19. ansible/errors/__init__.py +1 -1
  20. ansible/executor/interpreter_discovery.py +1 -1
  21. ansible/executor/module_common.py +39 -32
  22. ansible/executor/play_iterator.py +0 -15
  23. ansible/executor/playbook_executor.py +3 -3
  24. ansible/executor/powershell/module_manifest.py +1 -1
  25. ansible/executor/powershell/module_wrapper.ps1 +4 -1
  26. ansible/executor/process/worker.py +22 -7
  27. ansible/executor/task_executor.py +39 -40
  28. ansible/executor/task_queue_manager.py +8 -11
  29. ansible/galaxy/__init__.py +1 -1
  30. ansible/galaxy/api.py +8 -11
  31. ansible/galaxy/collection/__init__.py +17 -4
  32. ansible/galaxy/collection/concrete_artifact_manager.py +7 -2
  33. ansible/galaxy/collection/galaxy_api_proxy.py +1 -1
  34. ansible/galaxy/data/container/README.md +3 -5
  35. ansible/galaxy/dependency_resolution/__init__.py +1 -6
  36. ansible/galaxy/dependency_resolution/dataclasses.py +22 -1
  37. ansible/galaxy/dependency_resolution/providers.py +61 -69
  38. ansible/galaxy/role.py +31 -13
  39. ansible/galaxy/token.py +2 -2
  40. ansible/inventory/group.py +1 -1
  41. ansible/inventory/manager.py +1 -1
  42. ansible/module_utils/ansible_release.py +2 -2
  43. ansible/module_utils/basic.py +11 -41
  44. ansible/module_utils/common/file.py +0 -100
  45. ansible/module_utils/common/json.py +1 -1
  46. ansible/module_utils/common/locale.py +1 -1
  47. ansible/module_utils/common/text/converters.py +2 -2
  48. ansible/module_utils/common/validation.py +1 -1
  49. ansible/module_utils/compat/_selectors2.py +4 -4
  50. ansible/module_utils/compat/datetime.py +40 -0
  51. ansible/module_utils/compat/selinux.py +1 -1
  52. ansible/module_utils/compat/typing.py +1 -1
  53. ansible/module_utils/connection.py +1 -1
  54. ansible/module_utils/facts/hardware/linux.py +2 -2
  55. ansible/module_utils/facts/hardware/openbsd.py +1 -1
  56. ansible/module_utils/facts/network/linux.py +3 -3
  57. ansible/module_utils/facts/other/facter.py +8 -15
  58. ansible/module_utils/facts/sysctl.py +1 -1
  59. ansible/module_utils/facts/system/date_time.py +2 -2
  60. ansible/module_utils/facts/system/distribution.py +1 -1
  61. ansible/module_utils/facts/system/local.py +6 -2
  62. ansible/module_utils/facts/system/pkg_mgr.py +6 -1
  63. ansible/module_utils/facts/system/service_mgr.py +4 -2
  64. ansible/module_utils/parsing/convert_bool.py +1 -1
  65. ansible/module_utils/service.py +9 -6
  66. ansible/module_utils/urls.py +40 -22
  67. ansible/modules/add_host.py +2 -2
  68. ansible/modules/apt.py +48 -31
  69. ansible/modules/apt_key.py +4 -4
  70. ansible/modules/apt_repository.py +5 -5
  71. ansible/modules/assemble.py +7 -7
  72. ansible/modules/assert.py +1 -1
  73. ansible/modules/async_status.py +11 -7
  74. ansible/modules/async_wrapper.py +1 -1
  75. ansible/modules/blockinfile.py +60 -17
  76. ansible/modules/command.py +37 -15
  77. ansible/modules/copy.py +35 -30
  78. ansible/modules/cron.py +14 -14
  79. ansible/modules/deb822_repository.py +4 -3
  80. ansible/modules/debconf.py +35 -14
  81. ansible/modules/debug.py +1 -1
  82. ansible/modules/dnf.py +29 -27
  83. ansible/modules/dnf5.py +22 -22
  84. ansible/modules/dpkg_selections.py +9 -2
  85. ansible/modules/expect.py +4 -4
  86. ansible/modules/fetch.py +7 -7
  87. ansible/modules/file.py +30 -30
  88. ansible/modules/find.py +82 -22
  89. ansible/modules/gather_facts.py +6 -2
  90. ansible/modules/get_url.py +29 -29
  91. ansible/modules/getent.py +4 -4
  92. ansible/modules/git.py +27 -27
  93. ansible/modules/group.py +5 -12
  94. ansible/modules/hostname.py +21 -2
  95. ansible/modules/include_role.py +5 -5
  96. ansible/modules/include_tasks.py +2 -2
  97. ansible/modules/include_vars.py +5 -5
  98. ansible/modules/iptables.py +70 -65
  99. ansible/modules/known_hosts.py +7 -7
  100. ansible/modules/lineinfile.py +33 -33
  101. ansible/modules/meta.py +13 -13
  102. ansible/modules/package.py +8 -8
  103. ansible/modules/package_facts.py +3 -3
  104. ansible/modules/pause.py +2 -2
  105. ansible/modules/ping.py +5 -5
  106. ansible/modules/pip.py +80 -46
  107. ansible/modules/reboot.py +8 -4
  108. ansible/modules/replace.py +20 -15
  109. ansible/modules/rpm_key.py +2 -2
  110. ansible/modules/script.py +16 -10
  111. ansible/modules/service.py +26 -98
  112. ansible/modules/service_facts.py +36 -12
  113. ansible/modules/set_fact.py +2 -2
  114. ansible/modules/set_stats.py +2 -2
  115. ansible/modules/setup.py +18 -18
  116. ansible/modules/shell.py +3 -3
  117. ansible/modules/stat.py +9 -30
  118. ansible/modules/subversion.py +9 -9
  119. ansible/modules/systemd.py +20 -19
  120. ansible/modules/systemd_service.py +20 -19
  121. ansible/modules/sysvinit.py +26 -21
  122. ansible/modules/tempfile.py +5 -4
  123. ansible/modules/template.py +60 -6
  124. ansible/modules/unarchive.py +21 -18
  125. ansible/modules/uri.py +39 -39
  126. ansible/modules/user.py +81 -53
  127. ansible/modules/wait_for.py +22 -21
  128. ansible/modules/wait_for_connection.py +4 -4
  129. ansible/modules/yum.py +38 -38
  130. ansible/modules/yum_repository.py +58 -80
  131. ansible/parsing/dataloader.py +27 -27
  132. ansible/parsing/mod_args.py +1 -1
  133. ansible/parsing/plugin_docs.py +3 -3
  134. ansible/parsing/splitter.py +14 -16
  135. ansible/parsing/utils/yaml.py +1 -1
  136. ansible/parsing/vault/__init__.py +8 -6
  137. ansible/parsing/yaml/constructor.py +1 -1
  138. ansible/parsing/yaml/objects.py +1 -1
  139. ansible/playbook/__init__.py +1 -1
  140. ansible/playbook/base.py +2 -2
  141. ansible/playbook/block.py +0 -1
  142. ansible/playbook/conditional.py +40 -114
  143. ansible/playbook/helpers.py +5 -28
  144. ansible/playbook/included_file.py +8 -7
  145. ansible/playbook/play.py +1 -1
  146. ansible/playbook/play_context.py +2 -2
  147. ansible/playbook/playbook_include.py +2 -2
  148. ansible/playbook/role/__init__.py +1 -1
  149. ansible/playbook/role/include.py +1 -1
  150. ansible/playbook/role/metadata.py +1 -1
  151. ansible/playbook/role_include.py +1 -1
  152. ansible/playbook/task.py +2 -2
  153. ansible/playbook/task_include.py +1 -24
  154. ansible/plugins/__init__.py +13 -5
  155. ansible/plugins/action/__init__.py +17 -43
  156. ansible/plugins/action/add_host.py +2 -3
  157. ansible/plugins/action/assemble.py +1 -1
  158. ansible/plugins/action/assert.py +2 -1
  159. ansible/plugins/action/copy.py +2 -2
  160. ansible/plugins/action/debug.py +2 -1
  161. ansible/plugins/action/fail.py +1 -0
  162. ansible/plugins/action/fetch.py +3 -1
  163. ansible/plugins/action/gather_facts.py +37 -13
  164. ansible/plugins/action/group_by.py +1 -0
  165. ansible/plugins/action/include_vars.py +3 -2
  166. ansible/plugins/action/normal.py +3 -3
  167. ansible/plugins/action/pause.py +1 -1
  168. ansible/plugins/action/reboot.py +21 -16
  169. ansible/plugins/action/script.py +23 -8
  170. ansible/plugins/action/set_fact.py +1 -0
  171. ansible/plugins/action/set_stats.py +1 -0
  172. ansible/plugins/action/shell.py +6 -0
  173. ansible/plugins/action/template.py +1 -1
  174. ansible/plugins/action/unarchive.py +1 -1
  175. ansible/plugins/action/uri.py +1 -1
  176. ansible/plugins/action/validate_argument_spec.py +1 -0
  177. ansible/plugins/action/wait_for_connection.py +4 -4
  178. ansible/plugins/become/__init__.py +1 -1
  179. ansible/plugins/become/su.py +1 -1
  180. ansible/plugins/cache/__init__.py +1 -1
  181. ansible/plugins/callback/junit.py +1 -1
  182. ansible/plugins/callback/oneline.py +1 -1
  183. ansible/plugins/callback/tree.py +1 -1
  184. ansible/plugins/cliconf/__init__.py +2 -2
  185. ansible/plugins/connection/__init__.py +65 -37
  186. ansible/plugins/connection/local.py +9 -8
  187. ansible/plugins/connection/paramiko_ssh.py +34 -28
  188. ansible/plugins/connection/psrp.py +56 -43
  189. ansible/plugins/connection/ssh.py +67 -43
  190. ansible/plugins/connection/winrm.py +77 -30
  191. ansible/plugins/doc_fragments/constructed.py +4 -4
  192. ansible/plugins/doc_fragments/files.py +12 -12
  193. ansible/plugins/doc_fragments/inventory_cache.py +0 -6
  194. ansible/plugins/doc_fragments/result_format_callback.py +5 -5
  195. ansible/plugins/doc_fragments/shell_common.py +2 -2
  196. ansible/plugins/doc_fragments/shell_windows.py +1 -1
  197. ansible/plugins/doc_fragments/template_common.py +6 -6
  198. ansible/plugins/doc_fragments/url.py +10 -10
  199. ansible/plugins/doc_fragments/url_windows.py +15 -15
  200. ansible/plugins/doc_fragments/vars_plugin_staging.py +4 -4
  201. ansible/plugins/filter/b64decode.yml +1 -1
  202. ansible/plugins/filter/b64encode.yml +2 -2
  203. ansible/plugins/filter/bool.yml +5 -5
  204. ansible/plugins/filter/combine.yml +1 -1
  205. ansible/plugins/filter/commonpath.yml +2 -1
  206. ansible/plugins/filter/core.py +6 -8
  207. ansible/plugins/filter/dict2items.yml +11 -1
  208. ansible/plugins/filter/difference.yml +1 -0
  209. ansible/plugins/filter/encryption.py +1 -1
  210. ansible/plugins/filter/extract.yml +1 -1
  211. ansible/plugins/filter/flatten.yml +1 -1
  212. ansible/plugins/filter/from_yaml.yml +1 -1
  213. ansible/plugins/filter/from_yaml_all.yml +2 -2
  214. ansible/plugins/filter/hash.yml +1 -1
  215. ansible/plugins/filter/human_readable.yml +1 -1
  216. ansible/plugins/filter/human_to_bytes.yml +2 -2
  217. ansible/plugins/filter/intersect.yml +1 -0
  218. ansible/plugins/filter/mandatory.yml +7 -0
  219. ansible/plugins/filter/mathstuff.py +15 -17
  220. ansible/plugins/filter/normpath.yml +1 -1
  221. ansible/plugins/filter/path_join.yml +8 -1
  222. ansible/plugins/filter/realpath.yml +3 -2
  223. ansible/plugins/filter/regex_findall.yml +8 -2
  224. ansible/plugins/filter/regex_replace.yml +9 -3
  225. ansible/plugins/filter/regex_search.yml +8 -2
  226. ansible/plugins/filter/relpath.yml +2 -2
  227. ansible/plugins/filter/root.yml +1 -1
  228. ansible/plugins/filter/splitext.yml +1 -1
  229. ansible/plugins/filter/subelements.yml +2 -2
  230. ansible/plugins/filter/symmetric_difference.yml +1 -0
  231. ansible/plugins/filter/ternary.yml +5 -5
  232. ansible/plugins/filter/to_json.yml +7 -7
  233. ansible/plugins/filter/to_nice_json.yml +5 -5
  234. ansible/plugins/filter/to_yaml.yml +2 -2
  235. ansible/plugins/filter/type_debug.yml +1 -1
  236. ansible/plugins/filter/union.yml +1 -0
  237. ansible/plugins/filter/unvault.yml +2 -2
  238. ansible/plugins/filter/urldecode.yml +13 -32
  239. ansible/plugins/filter/urlsplit.py +1 -1
  240. ansible/plugins/filter/vault.yml +1 -1
  241. ansible/plugins/filter/zip.yml +1 -1
  242. ansible/plugins/filter/zip_longest.yml +1 -1
  243. ansible/plugins/inventory/__init__.py +1 -1
  244. ansible/plugins/inventory/advanced_host_list.py +1 -1
  245. ansible/plugins/inventory/constructed.py +2 -2
  246. ansible/plugins/inventory/host_list.py +1 -1
  247. ansible/plugins/inventory/ini.py +6 -3
  248. ansible/plugins/inventory/script.py +8 -2
  249. ansible/plugins/inventory/toml.py +1 -1
  250. ansible/plugins/inventory/yaml.py +1 -1
  251. ansible/plugins/list.py +21 -17
  252. ansible/plugins/loader.py +66 -88
  253. ansible/plugins/lookup/__init__.py +1 -1
  254. ansible/plugins/lookup/config.py +16 -6
  255. ansible/plugins/lookup/csvfile.py +7 -4
  256. ansible/plugins/lookup/env.py +1 -1
  257. ansible/plugins/lookup/file.py +5 -2
  258. ansible/plugins/lookup/fileglob.py +5 -2
  259. ansible/plugins/lookup/first_found.py +20 -14
  260. ansible/plugins/lookup/ini.py +6 -3
  261. ansible/plugins/lookup/lines.py +2 -1
  262. ansible/plugins/lookup/password.py +7 -7
  263. ansible/plugins/lookup/pipe.py +1 -0
  264. ansible/plugins/lookup/random_choice.py +2 -2
  265. ansible/plugins/lookup/sequence.py +1 -1
  266. ansible/plugins/lookup/subelements.py +2 -2
  267. ansible/plugins/lookup/template.py +4 -1
  268. ansible/plugins/lookup/unvault.py +4 -1
  269. ansible/plugins/lookup/url.py +6 -6
  270. ansible/plugins/lookup/varnames.py +1 -1
  271. ansible/plugins/netconf/__init__.py +3 -3
  272. ansible/plugins/shell/__init__.py +1 -1
  273. ansible/plugins/shell/cmd.py +7 -7
  274. ansible/plugins/shell/powershell.py +1 -1
  275. ansible/plugins/strategy/__init__.py +8 -10
  276. ansible/plugins/strategy/free.py +1 -1
  277. ansible/plugins/strategy/linear.py +3 -3
  278. ansible/plugins/terminal/__init__.py +2 -2
  279. ansible/plugins/test/abs.yml +1 -1
  280. ansible/plugins/test/all.yml +1 -1
  281. ansible/plugins/test/any.yml +1 -1
  282. ansible/plugins/test/change.yml +2 -2
  283. ansible/plugins/test/changed.yml +2 -2
  284. ansible/plugins/test/contains.yml +1 -1
  285. ansible/plugins/test/core.py +1 -1
  286. ansible/plugins/test/directory.yml +1 -1
  287. ansible/plugins/test/exists.yml +3 -2
  288. ansible/plugins/test/failed.yml +2 -2
  289. ansible/plugins/test/failure.yml +2 -2
  290. ansible/plugins/test/falsy.yml +2 -2
  291. ansible/plugins/test/file.yml +1 -1
  292. ansible/plugins/test/finished.yml +2 -2
  293. ansible/plugins/test/is_abs.yml +1 -1
  294. ansible/plugins/test/is_dir.yml +1 -1
  295. ansible/plugins/test/is_file.yml +1 -1
  296. ansible/plugins/test/is_link.yml +1 -1
  297. ansible/plugins/test/is_mount.yml +1 -1
  298. ansible/plugins/test/is_same_file.yml +1 -1
  299. ansible/plugins/test/isnan.yml +1 -1
  300. ansible/plugins/test/issubset.yml +1 -2
  301. ansible/plugins/test/issuperset.yml +1 -2
  302. ansible/plugins/test/link.yml +1 -1
  303. ansible/plugins/test/link_exists.yml +1 -1
  304. ansible/plugins/test/match.yml +2 -2
  305. ansible/plugins/test/mount.yml +1 -1
  306. ansible/plugins/test/nan.yml +1 -1
  307. ansible/plugins/test/reachable.yml +2 -2
  308. ansible/plugins/test/regex.yml +1 -1
  309. ansible/plugins/test/same_file.yml +1 -1
  310. ansible/plugins/test/search.yml +2 -2
  311. ansible/plugins/test/skip.yml +3 -3
  312. ansible/plugins/test/skipped.yml +3 -3
  313. ansible/plugins/test/started.yml +2 -2
  314. ansible/plugins/test/subset.yml +1 -2
  315. ansible/plugins/test/succeeded.yml +2 -2
  316. ansible/plugins/test/success.yml +2 -2
  317. ansible/plugins/test/successful.yml +2 -2
  318. ansible/plugins/test/superset.yml +1 -2
  319. ansible/plugins/test/truthy.yml +3 -3
  320. ansible/plugins/test/unreachable.yml +2 -2
  321. ansible/plugins/test/uri.yml +1 -1
  322. ansible/plugins/test/url.yml +1 -1
  323. ansible/plugins/test/urn.yml +1 -1
  324. ansible/plugins/test/vault_encrypted.yml +1 -1
  325. ansible/plugins/test/version.yml +7 -7
  326. ansible/plugins/test/version_compare.yml +7 -7
  327. ansible/plugins/vars/host_group_vars.py +1 -1
  328. ansible/release.py +2 -2
  329. ansible/template/__init__.py +24 -26
  330. ansible/template/native_helpers.py +1 -1
  331. ansible/template/vars.py +1 -1
  332. ansible/utils/_junit_xml.py +1 -1
  333. ansible/utils/cmd_functions.py +1 -1
  334. ansible/utils/collection_loader/_collection_finder.py +12 -1
  335. ansible/utils/display.py +113 -62
  336. ansible/utils/encrypt.py +11 -14
  337. ansible/utils/hashing.py +1 -1
  338. ansible/utils/jsonrpc.py +1 -1
  339. ansible/utils/path.py +1 -1
  340. ansible/utils/plugin_docs.py +1 -1
  341. ansible/utils/py3compat.py +1 -1
  342. ansible/utils/shlex.py +2 -10
  343. ansible/utils/ssh_functions.py +5 -4
  344. ansible/utils/unicode.py +1 -1
  345. ansible/utils/unsafe_proxy.py +1 -1
  346. ansible/utils/vars.py +4 -29
  347. ansible/vars/hostvars.py +1 -2
  348. ansible/vars/manager.py +13 -9
  349. ansible/vars/plugins.py +2 -2
  350. {ansible_core-2.15.4rc1.dist-info → ansible_core-2.16.0b2.dist-info}/COPYING +4 -5
  351. {ansible_core-2.15.4rc1.dist-info → ansible_core-2.16.0b2.dist-info}/METADATA +2 -4
  352. {ansible_core-2.15.4rc1.dist-info → ansible_core-2.16.0b2.dist-info}/RECORD +424 -425
  353. ansible_test/_data/completion/docker.txt +9 -9
  354. ansible_test/_data/completion/remote.txt +4 -7
  355. ansible_test/_data/completion/windows.txt +0 -2
  356. ansible_test/_data/requirements/ansible-test.txt +2 -1
  357. ansible_test/_data/requirements/ansible.txt +0 -3
  358. ansible_test/_data/requirements/constraints.txt +0 -2
  359. ansible_test/_data/requirements/sanity.ansible-doc.txt +3 -5
  360. ansible_test/_data/requirements/sanity.changelog.in +1 -2
  361. ansible_test/_data/requirements/sanity.changelog.txt +4 -6
  362. ansible_test/_data/requirements/sanity.import.plugin.txt +2 -4
  363. ansible_test/_data/requirements/sanity.import.txt +1 -3
  364. ansible_test/_data/requirements/sanity.integration-aliases.txt +1 -3
  365. ansible_test/_data/requirements/sanity.mypy.txt +12 -12
  366. ansible_test/_data/requirements/sanity.pep8.txt +1 -1
  367. ansible_test/_data/requirements/sanity.pylint.txt +6 -12
  368. ansible_test/_data/requirements/sanity.runtime-metadata.txt +1 -3
  369. ansible_test/_data/requirements/sanity.validate-modules.in +1 -1
  370. ansible_test/_data/requirements/sanity.validate-modules.txt +3 -5
  371. ansible_test/_data/requirements/sanity.yamllint.txt +3 -5
  372. ansible_test/_data/requirements/units.txt +0 -1
  373. ansible_test/_internal/ci/azp.py +4 -4
  374. ansible_test/_internal/cli/environments.py +0 -13
  375. ansible_test/_internal/commands/coverage/analyze/targets/__init__.py +4 -4
  376. ansible_test/_internal/commands/coverage/combine.py +1 -1
  377. ansible_test/_internal/commands/integration/cloud/acme.py +6 -8
  378. ansible_test/_internal/commands/integration/cloud/cs.py +4 -9
  379. ansible_test/_internal/commands/integration/cloud/galaxy.py +103 -96
  380. ansible_test/_internal/commands/integration/cloud/httptester.py +0 -3
  381. ansible_test/_internal/commands/integration/cloud/nios.py +7 -9
  382. ansible_test/_internal/commands/integration/cloud/openshift.py +2 -7
  383. ansible_test/_internal/commands/integration/cloud/vcenter.py +11 -95
  384. ansible_test/_internal/commands/sanity/__init__.py +10 -0
  385. ansible_test/_internal/commands/sanity/import.py +8 -2
  386. ansible_test/_internal/commands/sanity/pylint.py +27 -1
  387. ansible_test/_internal/commands/units/__init__.py +2 -1
  388. ansible_test/_internal/config.py +0 -7
  389. ansible_test/_internal/containers.py +11 -56
  390. ansible_test/_internal/core_ci.py +0 -7
  391. ansible_test/_internal/coverage_util.py +8 -3
  392. ansible_test/_internal/delegation.py +0 -1
  393. ansible_test/_internal/diff.py +1 -1
  394. ansible_test/_internal/docker_util.py +9 -2
  395. ansible_test/_internal/host_profiles.py +6 -6
  396. ansible_test/_internal/http.py +1 -1
  397. ansible_test/_internal/junit_xml.py +1 -1
  398. ansible_test/_internal/pypi_proxy.py +1 -1
  399. ansible_test/_internal/python_requirements.py +3 -8
  400. ansible_test/_internal/util.py +1 -6
  401. ansible_test/_util/controller/sanity/code-smell/no-get-exception.json +4 -0
  402. ansible_test/_util/controller/sanity/code-smell/replace-urlopen.json +4 -0
  403. ansible_test/_util/controller/sanity/code-smell/use-compat-six.json +4 -0
  404. ansible_test/_util/controller/sanity/mypy/ansible-core.ini +3 -0
  405. ansible_test/_util/controller/sanity/pylint/config/ansible-test-target.cfg +2 -0
  406. ansible_test/_util/controller/sanity/pylint/config/ansible-test.cfg +0 -1
  407. ansible_test/_util/controller/sanity/pylint/config/collection.cfg +1 -0
  408. ansible_test/_util/controller/sanity/pylint/plugins/deprecated.py +172 -10
  409. ansible_test/_util/controller/sanity/pylint/plugins/string_format.py +13 -2
  410. ansible_test/_util/controller/sanity/pylint/plugins/unwanted.py +7 -1
  411. ansible_test/_util/controller/sanity/validate-modules/validate_modules/main.py +6 -6
  412. ansible_test/_util/controller/sanity/validate-modules/validate_modules/module_args.py +1 -1
  413. ansible_test/_util/controller/sanity/validate-modules/validate_modules/utils.py +1 -1
  414. ansible_test/_util/controller/sanity/yamllint/yamllinter.py +3 -3
  415. ansible_test/_util/controller/tools/collection_detail.py +2 -2
  416. ansible_test/_util/target/common/constants.py +2 -2
  417. ansible_test/_util/target/pytest/plugins/ansible_forked.py +103 -0
  418. ansible_test/_util/target/sanity/import/importer.py +0 -8
  419. ansible_test/_util/target/setup/bootstrap.sh +36 -16
  420. ansible_test/_util/target/setup/quiet_pip.py +0 -4
  421. ansible/modules/_include.py +0 -80
  422. ansible_test/_internal/commands/integration/cloud/foreman.py +0 -102
  423. ansible_test/_util/target/setup/ConfigureRemotingForAnsible.ps1 +0 -435
  424. {ansible_core-2.15.4rc1.data → ansible_core-2.16.0b2.data}/scripts/ansible-test +0 -0
  425. {ansible_core-2.15.4rc1.dist-info → ansible_core-2.16.0b2.dist-info}/WHEEL +0 -0
  426. {ansible_core-2.15.4rc1.dist-info → ansible_core-2.16.0b2.dist-info}/entry_points.txt +0 -0
  427. {ansible_core-2.15.4rc1.dist-info → ansible_core-2.16.0b2.dist-info}/top_level.txt +0 -0
@@ -1,16 +1,10 @@
1
1
  # (c) 2019 Ansible Project
2
2
  # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
3
3
 
4
- from __future__ import (absolute_import, division, print_function)
5
- __metaclass__ = type
6
-
7
- import os
8
-
9
4
  from ansible.errors import AnsibleError
10
5
  from ansible.cli.galaxy import with_collection_artifacts_manager
11
6
  from ansible.galaxy.collection import find_existing_collections
12
- from ansible.module_utils._text import to_bytes
13
- from ansible.utils.collection_loader import AnsibleCollectionConfig
7
+ from ansible.module_utils.common.text.converters import to_bytes
14
8
  from ansible.utils.collection_loader._collection_finder import _get_collection_name_from_path
15
9
  from ansible.utils.display import Display
16
10
 
@@ -27,36 +21,6 @@ def list_collections(coll_filter=None, search_paths=None, dedupe=True, artifacts
27
21
  return collections
28
22
 
29
23
 
30
- def list_valid_collection_paths(search_paths=None, warn=False):
31
- """
32
- Filter out non existing or invalid search_paths for collections
33
- :param search_paths: list of text-string paths, if none load default config
34
- :param warn: display warning if search_path does not exist
35
- :return: subset of original list
36
- """
37
-
38
- if search_paths is None:
39
- search_paths = []
40
-
41
- search_paths.extend(AnsibleCollectionConfig.collection_paths)
42
-
43
- for path in search_paths:
44
-
45
- b_path = to_bytes(path)
46
- if not os.path.exists(b_path):
47
- # warn for missing, but not if default
48
- if warn:
49
- display.warning("The configured collection path {0} does not exist.".format(path))
50
- continue
51
-
52
- if not os.path.isdir(b_path):
53
- if warn:
54
- display.warning("The configured collection path {0}, exists, but it is not a directory.".format(path))
55
- continue
56
-
57
- yield path
58
-
59
-
60
24
  @with_collection_artifacts_manager
61
25
  def list_collection_dirs(search_paths=None, coll_filter=None, artifacts_manager=None, dedupe=True):
62
26
  """
@@ -68,16 +32,31 @@ def list_collection_dirs(search_paths=None, coll_filter=None, artifacts_manager=
68
32
 
69
33
  namespace_filter = None
70
34
  collection_filter = None
35
+ has_pure_namespace_filter = False # whether at least one coll_filter is a namespace-only filter
71
36
  if coll_filter is not None:
72
- if '.' in coll_filter:
73
- try:
74
- namespace_filter, collection_filter = coll_filter.split('.')
75
- except ValueError:
76
- raise AnsibleError("Invalid collection pattern supplied: %s" % coll_filter)
77
- else:
78
- namespace_filter = coll_filter
37
+ if isinstance(coll_filter, str):
38
+ coll_filter = [coll_filter]
39
+ namespace_filter = set()
40
+ for coll_name in coll_filter:
41
+ if '.' in coll_name:
42
+ try:
43
+ namespace, collection = coll_name.split('.')
44
+ except ValueError:
45
+ raise AnsibleError("Invalid collection pattern supplied: %s" % coll_name)
46
+ namespace_filter.add(namespace)
47
+ if not has_pure_namespace_filter:
48
+ if collection_filter is None:
49
+ collection_filter = []
50
+ collection_filter.append(collection)
51
+ else:
52
+ namespace_filter.add(coll_name)
53
+ has_pure_namespace_filter = True
54
+ collection_filter = None
55
+ namespace_filter = sorted(namespace_filter)
79
56
 
80
57
  for req in find_existing_collections(search_paths, artifacts_manager, namespace_filter=namespace_filter,
81
58
  collection_filter=collection_filter, dedupe=dedupe):
82
59
 
60
+ if not has_pure_namespace_filter and coll_filter is not None and req.fqcn not in coll_filter:
61
+ continue
83
62
  yield to_bytes(req.src)
@@ -2162,7 +2162,7 @@ plugin_routing:
2162
2162
  redirect: community.network.exos_vlans
2163
2163
  bigip_asm_policy:
2164
2164
  tombstone:
2165
- removal_date: 2019-11-06
2165
+ removal_date: "2019-11-06"
2166
2166
  warning_text: bigip_asm_policy has been removed please use bigip_asm_policy_manage instead.
2167
2167
  bigip_device_facts:
2168
2168
  redirect: f5networks.f5_modules.bigip_device_info
@@ -2176,11 +2176,11 @@ plugin_routing:
2176
2176
  redirect: f5networks.f5_modules.bigip_device_traffic_group
2177
2177
  bigip_facts:
2178
2178
  tombstone:
2179
- removal_date: 2019-11-06
2179
+ removal_date: "2019-11-06"
2180
2180
  warning_text: bigip_facts has been removed please use bigip_device_info module.
2181
2181
  bigip_gtm_facts:
2182
2182
  tombstone:
2183
- removal_date: 2019-11-06
2183
+ removal_date: "2019-11-06"
2184
2184
  warning_text: bigip_gtm_facts has been removed please use bigip_device_info module.
2185
2185
  faz_device:
2186
2186
  redirect: community.fortios.faz_device
@@ -7641,7 +7641,7 @@ plugin_routing:
7641
7641
  redirect: ngine_io.exoscale.exoscale
7642
7642
  f5_utils:
7643
7643
  tombstone:
7644
- removal_date: 2019-11-06
7644
+ removal_date: "2019-11-06"
7645
7645
  firewalld:
7646
7646
  redirect: ansible.posix.firewalld
7647
7647
  gcdns:
@@ -9084,6 +9084,10 @@ plugin_routing:
9084
9084
  redirect: dellemc.os6.os6
9085
9085
  vyos:
9086
9086
  redirect: vyos.vyos.vyos
9087
+ include:
9088
+ tombstone:
9089
+ removal_date: "2023-05-16"
9090
+ warning_text: Use include_tasks or import_tasks instead.
9087
9091
  become:
9088
9092
  doas:
9089
9093
  redirect: community.general.doas
ansible/config/base.yml CHANGED
@@ -200,12 +200,18 @@ COLLECTIONS_PATHS:
200
200
  default: '{{ ANSIBLE_HOME ~ "/collections:/usr/share/ansible/collections" }}'
201
201
  type: pathspec
202
202
  env:
203
- - name: ANSIBLE_COLLECTIONS_PATHS # TODO: Deprecate this and ini once PATH has been in a few releases.
203
+ - name: ANSIBLE_COLLECTIONS_PATHS
204
+ deprecated:
205
+ why: does not fit var naming standard, use the singular form ANSIBLE_COLLECTIONS_PATH instead
206
+ version: "2.19"
204
207
  - name: ANSIBLE_COLLECTIONS_PATH
205
208
  version_added: '2.10'
206
209
  ini:
207
210
  - key: collections_paths
208
211
  section: defaults
212
+ deprecated:
213
+ why: does not fit var naming standard, use the singular form collections_path instead
214
+ version: "2.19"
209
215
  - key: collections_path
210
216
  section: defaults
211
217
  version_added: '2.10'
@@ -220,11 +226,7 @@ COLLECTIONS_ON_ANSIBLE_VERSION_MISMATCH:
220
226
  warning: issue a warning but continue
221
227
  ignore: just continue silently
222
228
  default: warning
223
- _COLOR_DEFAULTS: &color
224
- name: placeholder for color settings' defaults
225
- choices: ['black', 'bright gray', 'blue', 'white', 'green', 'bright blue', 'cyan', 'bright green', 'red', 'bright cyan', 'purple', 'bright red', 'yellow', 'bright purple', 'dark gray', 'bright yellow', 'magenta', 'bright magenta', 'normal']
226
229
  COLOR_CHANGED:
227
- <<: *color
228
230
  name: Color for 'changed' task status
229
231
  default: yellow
230
232
  description: Defines the color to use on 'Changed' task status
@@ -232,7 +234,6 @@ COLOR_CHANGED:
232
234
  ini:
233
235
  - {key: changed, section: colors}
234
236
  COLOR_CONSOLE_PROMPT:
235
- <<: *color
236
237
  name: "Color for ansible-console's prompt task status"
237
238
  default: white
238
239
  description: Defines the default color to use for ansible-console
@@ -241,7 +242,6 @@ COLOR_CONSOLE_PROMPT:
241
242
  - {key: console_prompt, section: colors}
242
243
  version_added: "2.7"
243
244
  COLOR_DEBUG:
244
- <<: *color
245
245
  name: Color for debug statements
246
246
  default: dark gray
247
247
  description: Defines the color to use when emitting debug messages
@@ -249,7 +249,6 @@ COLOR_DEBUG:
249
249
  ini:
250
250
  - {key: debug, section: colors}
251
251
  COLOR_DEPRECATE:
252
- <<: *color
253
252
  name: Color for deprecation messages
254
253
  default: purple
255
254
  description: Defines the color to use when emitting deprecation messages
@@ -257,7 +256,6 @@ COLOR_DEPRECATE:
257
256
  ini:
258
257
  - {key: deprecate, section: colors}
259
258
  COLOR_DIFF_ADD:
260
- <<: *color
261
259
  name: Color for diff added display
262
260
  default: green
263
261
  description: Defines the color to use when showing added lines in diffs
@@ -266,7 +264,6 @@ COLOR_DIFF_ADD:
266
264
  - {key: diff_add, section: colors}
267
265
  yaml: {key: display.colors.diff.add}
268
266
  COLOR_DIFF_LINES:
269
- <<: *color
270
267
  name: Color for diff lines display
271
268
  default: cyan
272
269
  description: Defines the color to use when showing diffs
@@ -274,7 +271,6 @@ COLOR_DIFF_LINES:
274
271
  ini:
275
272
  - {key: diff_lines, section: colors}
276
273
  COLOR_DIFF_REMOVE:
277
- <<: *color
278
274
  name: Color for diff removed display
279
275
  default: red
280
276
  description: Defines the color to use when showing removed lines in diffs
@@ -282,7 +278,6 @@ COLOR_DIFF_REMOVE:
282
278
  ini:
283
279
  - {key: diff_remove, section: colors}
284
280
  COLOR_ERROR:
285
- <<: *color
286
281
  name: Color for error messages
287
282
  default: red
288
283
  description: Defines the color to use when emitting error messages
@@ -291,7 +286,6 @@ COLOR_ERROR:
291
286
  - {key: error, section: colors}
292
287
  yaml: {key: colors.error}
293
288
  COLOR_HIGHLIGHT:
294
- <<: *color
295
289
  name: Color for highlighting
296
290
  default: white
297
291
  description: Defines the color to use for highlighting
@@ -299,7 +293,6 @@ COLOR_HIGHLIGHT:
299
293
  ini:
300
294
  - {key: highlight, section: colors}
301
295
  COLOR_OK:
302
- <<: *color
303
296
  name: Color for 'ok' task status
304
297
  default: green
305
298
  description: Defines the color to use when showing 'OK' task status
@@ -307,7 +300,6 @@ COLOR_OK:
307
300
  ini:
308
301
  - {key: ok, section: colors}
309
302
  COLOR_SKIP:
310
- <<: *color
311
303
  name: Color for 'skip' task status
312
304
  default: cyan
313
305
  description: Defines the color to use when showing 'Skipped' task status
@@ -315,7 +307,6 @@ COLOR_SKIP:
315
307
  ini:
316
308
  - {key: skip, section: colors}
317
309
  COLOR_UNREACHABLE:
318
- <<: *color
319
310
  name: Color for 'unreachable' host state
320
311
  default: bright red
321
312
  description: Defines the color to use on 'Unreachable' status
@@ -323,7 +314,6 @@ COLOR_UNREACHABLE:
323
314
  ini:
324
315
  - {key: unreachable, section: colors}
325
316
  COLOR_VERBOSE:
326
- <<: *color
327
317
  name: Color for verbose messages
328
318
  default: blue
329
319
  description: Defines the color to use when emitting verbose messages. i.e those that show with '-v's.
@@ -331,7 +321,6 @@ COLOR_VERBOSE:
331
321
  ini:
332
322
  - {key: verbose, section: colors}
333
323
  COLOR_WARN:
334
- <<: *color
335
324
  name: Color for warning messages
336
325
  default: bright purple
337
326
  description: Defines the color to use when emitting warning messages
@@ -1096,10 +1085,11 @@ DEFAULT_TIMEOUT:
1096
1085
  - {key: timeout, section: defaults}
1097
1086
  type: integer
1098
1087
  DEFAULT_TRANSPORT:
1099
- # note that ssh_utils refs this and needs to be updated if removed
1100
1088
  name: Connection plugin
1101
- default: smart
1102
- description: "Default connection plugin to use, the 'smart' option will toggle between 'ssh' and 'paramiko' depending on controller OS and ssh versions"
1089
+ default: ssh
1090
+ description:
1091
+ - Can be any connection plugin available to your ansible installation.
1092
+ - There is also a (DEPRECATED) special 'smart' option, that will toggle between 'ssh' and 'paramiko' depending on controller OS and ssh versions.
1103
1093
  env: [{name: ANSIBLE_TRANSPORT}]
1104
1094
  ini:
1105
1095
  - {key: transport, section: defaults}
@@ -1336,6 +1326,15 @@ GALAXY_IGNORE_CERTS:
1336
1326
  ini:
1337
1327
  - {key: ignore_certs, section: galaxy}
1338
1328
  type: boolean
1329
+ GALAXY_SERVER_TIMEOUT:
1330
+ name: Default timeout to use for API calls
1331
+ description:
1332
+ - The default timeout for Galaxy API calls. Galaxy servers that don't configure a specific timeout will fall back to this value.
1333
+ env: [{name: ANSIBLE_GALAXY_SERVER_TIMEOUT}]
1334
+ default: 60
1335
+ ini:
1336
+ - {key: server_timeout, section: galaxy}
1337
+ type: int
1339
1338
  GALAXY_ROLE_SKELETON:
1340
1339
  name: Galaxy role skeleton directory
1341
1340
  description: Role skeleton directory to use as a template for the ``init`` action in ``ansible-galaxy``/``ansible-galaxy role``, same as ``--role-skeleton``.
@@ -1366,6 +1365,15 @@ GALAXY_COLLECTION_SKELETON_IGNORE:
1366
1365
  ini:
1367
1366
  - {key: collection_skeleton_ignore, section: galaxy}
1368
1367
  type: list
1368
+ GALAXY_COLLECTIONS_PATH_WARNING:
1369
+ name: "ansible-galaxy collection install colections path warnings"
1370
+ description: "whether ``ansible-galaxy collection install`` should warn about ``--collections-path`` missing from configured :ref:`collections_paths`"
1371
+ default: true
1372
+ type: bool
1373
+ env: [{name: ANSIBLE_GALAXY_COLLECTIONS_PATH_WARNING}]
1374
+ ini:
1375
+ - {key: collections_path_warning, section: galaxy}
1376
+ version_added: "2.16"
1369
1377
  # TODO: unused?
1370
1378
  #GALAXY_SCMS:
1371
1379
  # name: Galaxy SCMS
@@ -1548,13 +1556,13 @@ _INTERPRETER_PYTHON_DISTRO_MAP:
1548
1556
  INTERPRETER_PYTHON_FALLBACK:
1549
1557
  name: Ordered list of Python interpreters to check for in discovery
1550
1558
  default:
1559
+ - python3.12
1551
1560
  - python3.11
1552
1561
  - python3.10
1553
1562
  - python3.9
1554
1563
  - python3.8
1555
1564
  - python3.7
1556
1565
  - python3.6
1557
- - python3.5
1558
1566
  - /usr/bin/python3
1559
1567
  - /usr/libexec/platform-python
1560
1568
  - python2.7
@@ -2065,6 +2073,10 @@ STRING_CONVERSION_ACTION:
2065
2073
  - section: defaults
2066
2074
  key: string_conversion_action
2067
2075
  type: string
2076
+ deprecated:
2077
+ why: This option is no longer used in the Ansible Core code base.
2078
+ version: "2.19"
2079
+ alternatives: There is no alternative at the moment. A different mechanism would have to be implemented in the current code base.
2068
2080
  VALIDATE_ACTION_GROUP_METADATA:
2069
2081
  version_added: '2.12'
2070
2082
  description:
ansible/config/manager.py CHANGED
@@ -17,7 +17,7 @@ from collections.abc import Mapping, Sequence
17
17
  from jinja2.nativetypes import NativeEnvironment
18
18
 
19
19
  from ansible.errors import AnsibleOptionsError, AnsibleError
20
- from ansible.module_utils._text import to_text, to_bytes, to_native
20
+ from ansible.module_utils.common.text.converters import to_text, to_bytes, to_native
21
21
  from ansible.module_utils.common.yaml import yaml_load
22
22
  from ansible.module_utils.six import string_types
23
23
  from ansible.module_utils.parsing.convert_bool import boolean
ansible/constants.py CHANGED
@@ -10,7 +10,7 @@ import re
10
10
  from string import ascii_letters, digits
11
11
 
12
12
  from ansible.config.manager import ConfigManager
13
- from ansible.module_utils._text import to_text
13
+ from ansible.module_utils.common.text.converters import to_text
14
14
  from ansible.module_utils.common.collections import Sequence
15
15
  from ansible.module_utils.parsing.convert_bool import BOOLEANS_TRUE
16
16
  from ansible.release import __version__
@@ -64,7 +64,6 @@ _ACTION_DEBUG = add_internal_fqcns(('debug', ))
64
64
  _ACTION_IMPORT_PLAYBOOK = add_internal_fqcns(('import_playbook', ))
65
65
  _ACTION_IMPORT_ROLE = add_internal_fqcns(('import_role', ))
66
66
  _ACTION_IMPORT_TASKS = add_internal_fqcns(('import_tasks', ))
67
- _ACTION_INCLUDE = add_internal_fqcns(('include', ))
68
67
  _ACTION_INCLUDE_ROLE = add_internal_fqcns(('include_role', ))
69
68
  _ACTION_INCLUDE_TASKS = add_internal_fqcns(('include_tasks', ))
70
69
  _ACTION_INCLUDE_VARS = add_internal_fqcns(('include_vars', ))
@@ -74,12 +73,11 @@ _ACTION_SET_FACT = add_internal_fqcns(('set_fact', ))
74
73
  _ACTION_SETUP = add_internal_fqcns(('setup', ))
75
74
  _ACTION_HAS_CMD = add_internal_fqcns(('command', 'shell', 'script'))
76
75
  _ACTION_ALLOWS_RAW_ARGS = _ACTION_HAS_CMD + add_internal_fqcns(('raw', ))
77
- _ACTION_ALL_INCLUDES = _ACTION_INCLUDE + _ACTION_INCLUDE_TASKS + _ACTION_INCLUDE_ROLE
78
- _ACTION_ALL_INCLUDE_IMPORT_TASKS = _ACTION_INCLUDE + _ACTION_INCLUDE_TASKS + _ACTION_IMPORT_TASKS
76
+ _ACTION_ALL_INCLUDES = _ACTION_INCLUDE_TASKS + _ACTION_INCLUDE_ROLE
77
+ _ACTION_ALL_INCLUDE_IMPORT_TASKS = _ACTION_INCLUDE_TASKS + _ACTION_IMPORT_TASKS
79
78
  _ACTION_ALL_PROPER_INCLUDE_IMPORT_ROLES = _ACTION_INCLUDE_ROLE + _ACTION_IMPORT_ROLE
80
79
  _ACTION_ALL_PROPER_INCLUDE_IMPORT_TASKS = _ACTION_INCLUDE_TASKS + _ACTION_IMPORT_TASKS
81
80
  _ACTION_ALL_INCLUDE_ROLE_TASKS = _ACTION_INCLUDE_ROLE + _ACTION_INCLUDE_TASKS
82
- _ACTION_ALL_INCLUDE_TASKS = _ACTION_INCLUDE + _ACTION_INCLUDE_TASKS
83
81
  _ACTION_FACT_GATHERING = _ACTION_SETUP + add_internal_fqcns(('gather_facts', ))
84
82
  _ACTION_WITH_CLEAN_FACTS = _ACTION_SET_FACT + _ACTION_INCLUDE_VARS
85
83
 
@@ -34,7 +34,7 @@ from ansible.errors.yaml_strings import (
34
34
  YAML_POSITION_DETAILS,
35
35
  YAML_AND_SHORTHAND_ERROR,
36
36
  )
37
- from ansible.module_utils._text import to_native, to_text
37
+ from ansible.module_utils.common.text.converters import to_native, to_text
38
38
 
39
39
 
40
40
  class AnsibleError(Exception):
@@ -10,7 +10,7 @@ import pkgutil
10
10
  import re
11
11
 
12
12
  from ansible import constants as C
13
- from ansible.module_utils._text import to_native, to_text
13
+ from ansible.module_utils.common.text.converters import to_native, to_text
14
14
  from ansible.module_utils.distro import LinuxDistribution
15
15
  from ansible.utils.display import Display
16
16
  from ansible.utils.plugin_docs import get_versioned_doclink
@@ -26,6 +26,7 @@ import datetime
26
26
  import json
27
27
  import os
28
28
  import shlex
29
+ import time
29
30
  import zipfile
30
31
  import re
31
32
  import pkgutil
@@ -177,13 +178,13 @@ def _ansiballz_main():
177
178
  z = zipfile.ZipFile(modlib_path, mode='a')
178
179
 
179
180
  # py3: modlib_path will be text, py2: it's bytes. Need bytes at the end
180
- sitecustomize = u'import sys\\nsys.path.insert(0,"%%s")\\n' %% modlib_path
181
+ sitecustomize = u'import sys\\nsys.path.insert(0,"%%s")\\n' %% modlib_path
181
182
  sitecustomize = sitecustomize.encode('utf-8')
182
183
  # Use a ZipInfo to work around zipfile limitation on hosts with
183
184
  # clocks set to a pre-1980 year (for instance, Raspberry Pi)
184
185
  zinfo = zipfile.ZipInfo()
185
186
  zinfo.filename = 'sitecustomize.py'
186
- zinfo.date_time = ( %(year)i, %(month)i, %(day)i, %(hour)i, %(minute)i, %(second)i)
187
+ zinfo.date_time = %(date_time)s
187
188
  z.writestr(zinfo, sitecustomize)
188
189
  z.close()
189
190
 
@@ -870,7 +871,17 @@ class CollectionModuleUtilLocator(ModuleUtilLocatorBase):
870
871
  return name_parts[5:] # eg, foo.bar for ansible_collections.ns.coll.plugins.module_utils.foo.bar
871
872
 
872
873
 
873
- def recursive_finder(name, module_fqn, module_data, zf):
874
+ def _make_zinfo(filename, date_time, zf=None):
875
+ zinfo = zipfile.ZipInfo(
876
+ filename=filename,
877
+ date_time=date_time
878
+ )
879
+ if zf:
880
+ zinfo.compress_type = zf.compression
881
+ return zinfo
882
+
883
+
884
+ def recursive_finder(name, module_fqn, module_data, zf, date_time=None):
874
885
  """
875
886
  Using ModuleDepFinder, make sure we have all of the module_utils files that
876
887
  the module and its module_utils files needs. (no longer actually recursive)
@@ -880,6 +891,8 @@ def recursive_finder(name, module_fqn, module_data, zf):
880
891
  :arg zf: An open :python:class:`zipfile.ZipFile` object that holds the Ansible module payload
881
892
  which we're assembling
882
893
  """
894
+ if date_time is None:
895
+ date_time = time.gmtime()[:6]
883
896
 
884
897
  # py_module_cache maps python module names to a tuple of the code in the module
885
898
  # and the pathname to the module.
@@ -976,7 +989,10 @@ def recursive_finder(name, module_fqn, module_data, zf):
976
989
  for py_module_name in py_module_cache:
977
990
  py_module_file_name = py_module_cache[py_module_name][1]
978
991
 
979
- zf.writestr(py_module_file_name, py_module_cache[py_module_name][0])
992
+ zf.writestr(
993
+ _make_zinfo(py_module_file_name, date_time, zf=zf),
994
+ py_module_cache[py_module_name][0]
995
+ )
980
996
  mu_file = to_text(py_module_file_name, errors='surrogate_or_strict')
981
997
  display.vvvvv("Including module_utils file %s" % mu_file)
982
998
 
@@ -1020,13 +1036,16 @@ def _get_ansible_module_fqn(module_path):
1020
1036
  return remote_module_fqn
1021
1037
 
1022
1038
 
1023
- def _add_module_to_zip(zf, remote_module_fqn, b_module_data):
1039
+ def _add_module_to_zip(zf, date_time, remote_module_fqn, b_module_data):
1024
1040
  """Add a module from ansible or from an ansible collection into the module zip"""
1025
1041
  module_path_parts = remote_module_fqn.split('.')
1026
1042
 
1027
1043
  # Write the module
1028
1044
  module_path = '/'.join(module_path_parts) + '.py'
1029
- zf.writestr(module_path, b_module_data)
1045
+ zf.writestr(
1046
+ _make_zinfo(module_path, date_time, zf=zf),
1047
+ b_module_data
1048
+ )
1030
1049
 
1031
1050
  # Write the __init__.py's necessary to get there
1032
1051
  if module_path_parts[0] == 'ansible':
@@ -1045,7 +1064,10 @@ def _add_module_to_zip(zf, remote_module_fqn, b_module_data):
1045
1064
  continue
1046
1065
  # Note: We don't want to include more than one ansible module in a payload at this time
1047
1066
  # so no need to fill the __init__.py with namespace code
1048
- zf.writestr(package_path, b'')
1067
+ zf.writestr(
1068
+ _make_zinfo(package_path, date_time, zf=zf),
1069
+ b''
1070
+ )
1049
1071
 
1050
1072
 
1051
1073
  def _find_module_utils(module_name, b_module_data, module_path, module_args, task_vars, templar, module_compression, async_timeout, become,
@@ -1110,6 +1132,10 @@ def _find_module_utils(module_name, b_module_data, module_path, module_args, tas
1110
1132
  remote_module_fqn = 'ansible.modules.%s' % module_name
1111
1133
 
1112
1134
  if module_substyle == 'python':
1135
+ date_time = time.gmtime()[:6]
1136
+ if date_time[0] < 1980:
1137
+ date_string = datetime.datetime(*date_time, tzinfo=datetime.timezone.utc).strftime('%c')
1138
+ raise AnsibleError(f'Cannot create zipfile due to pre-1980 configured date: {date_string}')
1113
1139
  params = dict(ANSIBLE_MODULE_ARGS=module_args,)
1114
1140
  try:
1115
1141
  python_repred_params = repr(json.dumps(params, cls=AnsibleJSONEncoder, vault_to_text=True))
@@ -1155,10 +1181,10 @@ def _find_module_utils(module_name, b_module_data, module_path, module_args, tas
1155
1181
  zf = zipfile.ZipFile(zipoutput, mode='w', compression=compression_method)
1156
1182
 
1157
1183
  # walk the module imports, looking for module_utils to send- they'll be added to the zipfile
1158
- recursive_finder(module_name, remote_module_fqn, b_module_data, zf)
1184
+ recursive_finder(module_name, remote_module_fqn, b_module_data, zf, date_time)
1159
1185
 
1160
1186
  display.debug('ANSIBALLZ: Writing module into payload')
1161
- _add_module_to_zip(zf, remote_module_fqn, b_module_data)
1187
+ _add_module_to_zip(zf, date_time, remote_module_fqn, b_module_data)
1162
1188
 
1163
1189
  zf.close()
1164
1190
  zipdata = base64.b64encode(zipoutput.getvalue())
@@ -1241,7 +1267,6 @@ def _find_module_utils(module_name, b_module_data, module_path, module_args, tas
1241
1267
  else:
1242
1268
  coverage = ''
1243
1269
 
1244
- now = datetime.datetime.utcnow()
1245
1270
  output.write(to_bytes(ACTIVE_ANSIBALLZ_TEMPLATE % dict(
1246
1271
  zipdata=zipdata,
1247
1272
  ansible_module=module_name,
@@ -1249,12 +1274,7 @@ def _find_module_utils(module_name, b_module_data, module_path, module_args, tas
1249
1274
  params=python_repred_params,
1250
1275
  shebang=shebang,
1251
1276
  coding=ENCODING_STRING,
1252
- year=now.year,
1253
- month=now.month,
1254
- day=now.day,
1255
- hour=now.hour,
1256
- minute=now.minute,
1257
- second=now.second,
1277
+ date_time=date_time,
1258
1278
  coverage=coverage,
1259
1279
  rlimit=rlimit,
1260
1280
  )))
@@ -1377,20 +1397,7 @@ def modify_module(module_name, module_path, module_args, templar, task_vars=None
1377
1397
  return (b_module_data, module_style, shebang)
1378
1398
 
1379
1399
 
1380
- def get_action_args_with_defaults(action, args, defaults, templar, redirected_names=None, action_groups=None):
1381
- if redirected_names:
1382
- resolved_action_name = redirected_names[-1]
1383
- else:
1384
- resolved_action_name = action
1385
-
1386
- if redirected_names is not None:
1387
- msg = (
1388
- "Finding module_defaults for the action %s. "
1389
- "The caller passed a list of redirected action names, which is deprecated. "
1390
- "The task's resolved action should be provided as the first argument instead."
1391
- )
1392
- display.deprecated(msg % resolved_action_name, version='2.16')
1393
-
1400
+ def get_action_args_with_defaults(action, args, defaults, templar, action_groups=None):
1394
1401
  # Get the list of groups that contain this action
1395
1402
  if action_groups is None:
1396
1403
  msg = (
@@ -1401,7 +1408,7 @@ def get_action_args_with_defaults(action, args, defaults, templar, redirected_na
1401
1408
  display.warning(msg=msg)
1402
1409
  group_names = []
1403
1410
  else:
1404
- group_names = action_groups.get(resolved_action_name, [])
1411
+ group_names = action_groups.get(action, [])
1405
1412
 
1406
1413
  tmp_args = {}
1407
1414
  module_defaults = {}
@@ -1420,7 +1427,7 @@ def get_action_args_with_defaults(action, args, defaults, templar, redirected_na
1420
1427
  tmp_args.update((module_defaults.get('group/%s' % group_name) or {}).copy())
1421
1428
 
1422
1429
  # handle specific action defaults
1423
- tmp_args.update(module_defaults.get(resolved_action_name, {}).copy())
1430
+ tmp_args.update(module_defaults.get(action, {}).copy())
1424
1431
 
1425
1432
  # direct args override all
1426
1433
  tmp_args.update(args)
@@ -241,13 +241,6 @@ class PlayIterator:
241
241
 
242
242
  return self._host_states[host.name].copy()
243
243
 
244
- def cache_block_tasks(self, block):
245
- display.deprecated(
246
- 'PlayIterator.cache_block_tasks is now noop due to the changes '
247
- 'in the way tasks are cached and is deprecated.',
248
- version=2.16
249
- )
250
-
251
244
  def get_next_task_for_host(self, host, peek=False):
252
245
 
253
246
  display.debug("getting the next task for host %s" % host.name)
@@ -584,14 +577,6 @@ class PlayIterator:
584
577
  return self.is_any_block_rescuing(state.always_child_state)
585
578
  return False
586
579
 
587
- def get_original_task(self, host, task):
588
- display.deprecated(
589
- 'PlayIterator.get_original_task is now noop due to the changes '
590
- 'in the way tasks are cached and is deprecated.',
591
- version=2.16
592
- )
593
- return (None, None)
594
-
595
580
  def _insert_tasks_into_state(self, state, task_list):
596
581
  # if we've failed at all, or if the task list is empty, just return the current state
597
582
  if (state.fail_state != FailedStates.NONE and state.run_state == IteratingStates.TASKS) or not task_list:
@@ -24,7 +24,7 @@ import os
24
24
  from ansible import constants as C
25
25
  from ansible import context
26
26
  from ansible.executor.task_queue_manager import TaskQueueManager, AnsibleEndPlay
27
- from ansible.module_utils._text import to_text
27
+ from ansible.module_utils.common.text.converters import to_text
28
28
  from ansible.module_utils.parsing.convert_bool import boolean
29
29
  from ansible.plugins.loader import become_loader, connection_loader, shell_loader
30
30
  from ansible.playbook import Playbook
@@ -148,7 +148,7 @@ class PlaybookExecutor:
148
148
  encrypt = var.get("encrypt", None)
149
149
  salt_size = var.get("salt_size", None)
150
150
  salt = var.get("salt", None)
151
- unsafe = var.get("unsafe", None)
151
+ unsafe = boolean(var.get("unsafe", False))
152
152
 
153
153
  if vname not in self._variable_manager.extra_vars:
154
154
  if self._tqm:
@@ -238,7 +238,7 @@ class PlaybookExecutor:
238
238
  else:
239
239
  basedir = '~/'
240
240
 
241
- (retry_name, _) = os.path.splitext(os.path.basename(playbook_path))
241
+ (retry_name, ext) = os.path.splitext(os.path.basename(playbook_path))
242
242
  filename = os.path.join(basedir, "%s.retry" % retry_name)
243
243
  if self._generate_retry_inventory(filename, retries):
244
244
  display.display("\tto retry, use: --limit @%s\n" % filename)
@@ -16,7 +16,7 @@ from ansible.module_utils.compat.version import LooseVersion
16
16
 
17
17
  from ansible import constants as C
18
18
  from ansible.errors import AnsibleError
19
- from ansible.module_utils._text import to_bytes, to_native, to_text
19
+ from ansible.module_utils.common.text.converters import to_bytes, to_native, to_text
20
20
  from ansible.module_utils.compat.importlib import import_module
21
21
  from ansible.plugins.loader import ps_module_utils_loader
22
22
  from ansible.utils.collection_loader import resource_from_fqcr
@@ -207,7 +207,10 @@ if ($null -ne $rc) {
207
207
  # with the trap handler that's now in place, this should only write to the output if
208
208
  # $ErrorActionPreference != "Stop", that's ok because this is sent to the stderr output
209
209
  # for a user to manually debug if something went horribly wrong
210
- if ($ps.HadErrors -or ($PSVersionTable.PSVersion.Major -lt 4 -and $ps.Streams.Error.Count -gt 0)) {
210
+ if (
211
+ $ps.Streams.Error.Count -and
212
+ ($ps.HadErrors -or $PSVersionTable.PSVersion.Major -lt 4)
213
+ ) {
211
214
  Write-AnsibleLog "WARN - module had errors, outputting error info $ModuleName" "module_wrapper"
212
215
  # if the rc wasn't explicitly set, we return an exit code of 1
213
216
  if ($null -eq $rc) {