ansible-core 2.19.2rc1__py3-none-any.whl → 2.20.0b1__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.
- ansible/_internal/__init__.py +1 -4
- ansible/_internal/_ansiballz/_builder.py +1 -3
- ansible/_internal/_collection_proxy.py +7 -9
- ansible/_internal/_display_utils.py +145 -0
- ansible/_internal/_json/__init__.py +3 -4
- ansible/_internal/_templating/_engine.py +1 -1
- ansible/_internal/_templating/_jinja_plugins.py +1 -2
- ansible/_internal/_wrapt.py +105 -301
- ansible/cli/__init__.py +11 -10
- ansible/cli/adhoc.py +1 -2
- ansible/cli/arguments/option_helpers.py +1 -1
- ansible/cli/config.py +5 -6
- ansible/cli/doc.py +67 -67
- ansible/cli/galaxy.py +15 -24
- ansible/cli/inventory.py +0 -1
- ansible/cli/playbook.py +0 -1
- ansible/cli/pull.py +0 -1
- ansible/cli/scripts/ansible_connection_cli_stub.py +1 -1
- ansible/config/base.yml +1 -25
- ansible/config/manager.py +0 -2
- ansible/executor/play_iterator.py +42 -20
- ansible/executor/playbook_executor.py +0 -9
- ansible/executor/powershell/async_watchdog.ps1 +24 -4
- ansible/executor/task_executor.py +32 -22
- ansible/executor/task_queue_manager.py +1 -3
- ansible/galaxy/api.py +33 -80
- ansible/galaxy/collection/__init__.py +4 -17
- ansible/galaxy/dependency_resolution/dataclasses.py +0 -10
- ansible/galaxy/dependency_resolution/providers.py +1 -2
- ansible/galaxy/role.py +1 -33
- ansible/inventory/manager.py +2 -3
- ansible/keyword_desc.yml +0 -3
- ansible/module_utils/_internal/_datatag/__init__.py +2 -10
- ansible/module_utils/_internal/_no_six.py +86 -0
- ansible/module_utils/_text.py +28 -8
- ansible/module_utils/ansible_release.py +2 -2
- ansible/module_utils/basic.py +27 -24
- ansible/module_utils/common/_collections_compat.py +11 -2
- ansible/module_utils/common/collections.py +8 -3
- ansible/module_utils/common/dict_transformations.py +1 -2
- ansible/module_utils/common/network.py +4 -2
- ansible/module_utils/common/parameters.py +32 -41
- ansible/module_utils/common/text/converters.py +109 -23
- ansible/module_utils/common/text/formatters.py +6 -2
- ansible/module_utils/common/validation.py +11 -9
- ansible/module_utils/connection.py +8 -3
- ansible/module_utils/facts/hardware/linux.py +23 -7
- ansible/module_utils/facts/hardware/netbsd.py +1 -1
- ansible/module_utils/facts/hardware/sunos.py +2 -1
- ansible/module_utils/facts/packages.py +6 -2
- ansible/module_utils/facts/system/distribution.py +2 -1
- ansible/module_utils/facts/system/env.py +6 -3
- ansible/module_utils/facts/system/local.py +3 -1
- ansible/module_utils/parsing/convert_bool.py +6 -2
- ansible/module_utils/service.py +2 -3
- ansible/module_utils/six/__init__.py +11 -6
- ansible/module_utils/urls.py +6 -2
- ansible/module_utils/yumdnf.py +0 -5
- ansible/modules/apt.py +18 -13
- ansible/modules/apt_repository.py +1 -1
- ansible/modules/assemble.py +5 -9
- ansible/modules/blockinfile.py +39 -23
- ansible/modules/cron.py +26 -35
- ansible/modules/deb822_repository.py +83 -12
- ansible/modules/dnf.py +3 -7
- ansible/modules/dnf5.py +4 -6
- ansible/modules/expect.py +0 -3
- ansible/modules/find.py +1 -2
- ansible/modules/get_url.py +1 -1
- ansible/modules/git.py +4 -5
- ansible/modules/include_vars.py +1 -1
- ansible/modules/lineinfile.py +71 -63
- ansible/modules/package_facts.py +1 -1
- ansible/modules/pip.py +8 -2
- ansible/modules/replace.py +6 -6
- ansible/modules/service.py +3 -4
- ansible/modules/stat.py +20 -0
- ansible/modules/uri.py +9 -10
- ansible/modules/user.py +1 -2
- ansible/modules/wait_for.py +2 -2
- ansible/modules/wait_for_connection.py +2 -1
- ansible/modules/yum_repository.py +1 -16
- ansible/parsing/dataloader.py +24 -31
- ansible/parsing/mod_args.py +3 -0
- ansible/parsing/vault/__init__.py +1 -2
- ansible/playbook/base.py +8 -56
- ansible/playbook/block.py +0 -60
- ansible/playbook/collectionsearch.py +1 -2
- ansible/playbook/handler.py +1 -7
- ansible/playbook/helpers.py +0 -7
- ansible/playbook/included_file.py +1 -1
- ansible/playbook/play.py +103 -37
- ansible/playbook/play_context.py +4 -0
- ansible/playbook/role/__init__.py +10 -65
- ansible/playbook/role/definition.py +3 -4
- ansible/playbook/role/include.py +2 -3
- ansible/playbook/role/metadata.py +1 -12
- ansible/playbook/role/requirement.py +1 -2
- ansible/playbook/role_include.py +1 -2
- ansible/playbook/taggable.py +16 -5
- ansible/playbook/task.py +51 -55
- ansible/plugins/action/__init__.py +20 -19
- ansible/plugins/action/add_host.py +1 -2
- ansible/plugins/action/fetch.py +2 -4
- ansible/plugins/action/group_by.py +1 -2
- ansible/plugins/action/include_vars.py +20 -22
- ansible/plugins/action/script.py +1 -3
- ansible/plugins/action/template.py +1 -2
- ansible/plugins/action/uri.py +4 -2
- ansible/plugins/cache/__init__.py +1 -0
- ansible/plugins/callback/__init__.py +13 -6
- ansible/plugins/connection/__init__.py +3 -7
- ansible/plugins/connection/local.py +2 -3
- ansible/plugins/connection/psrp.py +0 -2
- ansible/plugins/connection/ssh.py +2 -7
- ansible/plugins/connection/winrm.py +0 -2
- ansible/plugins/doc_fragments/result_format_callback.py +15 -0
- ansible/plugins/filter/core.py +4 -5
- ansible/plugins/filter/encryption.py +3 -27
- ansible/plugins/filter/mathstuff.py +1 -2
- ansible/plugins/filter/to_nice_yaml.yml +31 -3
- ansible/plugins/filter/to_yaml.yml +29 -12
- ansible/plugins/inventory/__init__.py +1 -2
- ansible/plugins/inventory/script.py +2 -1
- ansible/plugins/inventory/toml.py +3 -6
- ansible/plugins/inventory/yaml.py +1 -2
- ansible/plugins/list.py +10 -3
- ansible/plugins/loader.py +6 -6
- ansible/plugins/lookup/password.py +1 -2
- ansible/plugins/lookup/subelements.py +2 -3
- ansible/plugins/lookup/url.py +1 -1
- ansible/plugins/lookup/varnames.py +1 -2
- ansible/plugins/shell/__init__.py +9 -4
- ansible/plugins/shell/powershell.py +8 -24
- ansible/plugins/strategy/__init__.py +6 -3
- ansible/plugins/test/core.py +4 -1
- ansible/plugins/test/regex.yml +18 -6
- ansible/release.py +2 -2
- ansible/template/__init__.py +3 -7
- ansible/utils/collection_loader/_collection_config.py +5 -0
- ansible/utils/collection_loader/_collection_finder.py +11 -14
- ansible/utils/context_objects.py +7 -4
- ansible/utils/display.py +28 -167
- ansible/utils/encrypt.py +0 -5
- ansible/utils/helpers.py +6 -2
- ansible/utils/jsonrpc.py +7 -3
- ansible/utils/plugin_docs.py +49 -38
- ansible/utils/ssh_functions.py +0 -19
- ansible/utils/unsafe_proxy.py +7 -7
- ansible/vars/clean.py +2 -3
- ansible/vars/manager.py +27 -20
- ansible/vars/plugins.py +1 -31
- {ansible_core-2.19.2rc1.dist-info → ansible_core-2.20.0b1.dist-info}/METADATA +3 -3
- {ansible_core-2.19.2rc1.dist-info → ansible_core-2.20.0b1.dist-info}/RECORD +200 -200
- ansible_test/_data/completion/docker.txt +7 -7
- ansible_test/_data/completion/network.txt +0 -1
- ansible_test/_data/completion/remote.txt +4 -4
- ansible_test/_data/requirements/ansible-test.txt +1 -1
- ansible_test/_data/requirements/sanity.changelog.txt +1 -1
- ansible_test/_data/requirements/sanity.pep8.txt +1 -1
- ansible_test/_data/requirements/sanity.pylint.txt +4 -4
- ansible_test/_internal/cache.py +2 -5
- ansible_test/_internal/cli/compat.py +1 -1
- ansible_test/_internal/commands/coverage/combine.py +1 -3
- ansible_test/_internal/commands/integration/__init__.py +3 -7
- ansible_test/_internal/commands/integration/cloud/httptester.py +1 -1
- ansible_test/_internal/commands/integration/coverage.py +1 -3
- ansible_test/_internal/commands/integration/filters.py +5 -10
- ansible_test/_internal/commands/sanity/validate_modules.py +1 -5
- ansible_test/_internal/commands/units/__init__.py +1 -13
- ansible_test/_internal/completion.py +2 -5
- ansible_test/_internal/config.py +2 -7
- ansible_test/_internal/coverage_util.py +1 -1
- ansible_test/_internal/delegation.py +2 -0
- ansible_test/_internal/docker_util.py +1 -1
- ansible_test/_internal/host_profiles.py +6 -11
- ansible_test/_internal/provider/__init__.py +2 -5
- ansible_test/_internal/provisioning.py +2 -5
- ansible_test/_internal/pypi_proxy.py +1 -1
- ansible_test/_internal/target.py +2 -6
- ansible_test/_internal/thread.py +1 -4
- ansible_test/_internal/util.py +9 -14
- ansible_test/_util/controller/sanity/code-smell/runtime-metadata.py +14 -19
- ansible_test/_util/controller/sanity/pylint/plugins/unwanted.py +30 -27
- ansible_test/_util/controller/sanity/validate-modules/validate_modules/main.py +31 -18
- ansible_test/_util/controller/sanity/validate-modules/validate_modules/module_args.py +1 -2
- ansible_test/_util/controller/sanity/validate-modules/validate_modules/schema.py +59 -71
- ansible_test/_util/controller/sanity/validate-modules/validate_modules/utils.py +1 -2
- ansible_test/_util/target/cli/ansible_test_cli_stub.py +4 -2
- ansible_test/_util/target/common/constants.py +2 -2
- ansible_test/_util/target/setup/bootstrap.sh +0 -6
- ansible/utils/py3compat.py +0 -27
- ansible_test/_data/pytest/config/legacy.ini +0 -4
- {ansible_core-2.19.2rc1.dist-info → ansible_core-2.20.0b1.dist-info}/WHEEL +0 -0
- {ansible_core-2.19.2rc1.dist-info → ansible_core-2.20.0b1.dist-info}/entry_points.txt +0 -0
- {ansible_core-2.19.2rc1.dist-info → ansible_core-2.20.0b1.dist-info}/licenses/COPYING +0 -0
- {ansible_core-2.19.2rc1.dist-info → ansible_core-2.20.0b1.dist-info}/licenses/licenses/Apache-License.txt +0 -0
- {ansible_core-2.19.2rc1.dist-info → ansible_core-2.20.0b1.dist-info}/licenses/licenses/BSD-3-Clause.txt +0 -0
- {ansible_core-2.19.2rc1.dist-info → ansible_core-2.20.0b1.dist-info}/licenses/licenses/MIT-license.txt +0 -0
- {ansible_core-2.19.2rc1.dist-info → ansible_core-2.20.0b1.dist-info}/licenses/licenses/PSF-license.txt +0 -0
- {ansible_core-2.19.2rc1.dist-info → ansible_core-2.20.0b1.dist-info}/licenses/licenses/simplified_bsd.txt +0 -0
- {ansible_core-2.19.2rc1.dist-info → ansible_core-2.20.0b1.dist-info}/top_level.txt +0 -0
|
@@ -13,7 +13,6 @@ from urllib.parse import urlparse
|
|
|
13
13
|
|
|
14
14
|
from voluptuous import ALLOW_EXTRA, PREVENT_EXTRA, All, Any, Invalid, Length, MultipleInvalid, Required, Schema, Self, ValueInvalid, Exclusive
|
|
15
15
|
from ansible.constants import DOCUMENTABLE_PLUGINS
|
|
16
|
-
from ansible.module_utils.six import string_types
|
|
17
16
|
from ansible.module_utils.common.collections import is_iterable
|
|
18
17
|
from ansible.module_utils.parsing.convert_bool import boolean
|
|
19
18
|
from ansible.parsing.quoting import unquote
|
|
@@ -25,9 +24,8 @@ from antsibull_docs_parser.parser import parse, Context
|
|
|
25
24
|
|
|
26
25
|
from .utils import parse_isodate
|
|
27
26
|
|
|
28
|
-
list_string_types =
|
|
29
|
-
tuple_string_types =
|
|
30
|
-
any_string_types = Any(*string_types)
|
|
27
|
+
list_string_types = [str]
|
|
28
|
+
tuple_string_types = (str,)
|
|
31
29
|
|
|
32
30
|
# Valid DOCUMENTATION.author lines
|
|
33
31
|
# Based on Ansibulbot's extract_github_id()
|
|
@@ -57,7 +55,7 @@ FULLY_QUALIFIED_COLLECTION_RESOURCE_RE = re.compile(r'^\w+(?:\.\w+){2,}$')
|
|
|
57
55
|
|
|
58
56
|
|
|
59
57
|
def collection_name(v, error_code=None):
|
|
60
|
-
if not isinstance(v,
|
|
58
|
+
if not isinstance(v, str):
|
|
61
59
|
raise _add_ansible_error_code(
|
|
62
60
|
Invalid('Collection name must be a string'), error_code or 'collection-invalid-name')
|
|
63
61
|
m = COLLECTION_NAME_RE.match(v)
|
|
@@ -68,7 +66,7 @@ def collection_name(v, error_code=None):
|
|
|
68
66
|
|
|
69
67
|
|
|
70
68
|
def fqcn(v, error_code=None):
|
|
71
|
-
if not isinstance(v,
|
|
69
|
+
if not isinstance(v, str):
|
|
72
70
|
raise _add_ansible_error_code(
|
|
73
71
|
Invalid('Module/plugin name must be a string'), error_code or 'invalid-documentation')
|
|
74
72
|
m = FULLY_QUALIFIED_COLLECTION_RESOURCE_RE.match(v)
|
|
@@ -87,8 +85,8 @@ def deprecation_versions():
|
|
|
87
85
|
def version(for_collection=False):
|
|
88
86
|
if for_collection:
|
|
89
87
|
# We do not accept floats for versions in collections
|
|
90
|
-
return
|
|
91
|
-
return Any(float,
|
|
88
|
+
return str
|
|
89
|
+
return Any(float, str)
|
|
92
90
|
|
|
93
91
|
|
|
94
92
|
def date(error_code=None):
|
|
@@ -128,7 +126,7 @@ def _check_url(directive, content):
|
|
|
128
126
|
|
|
129
127
|
def doc_string(v):
|
|
130
128
|
"""Match a documentation string."""
|
|
131
|
-
if not isinstance(v,
|
|
129
|
+
if not isinstance(v, str):
|
|
132
130
|
raise _add_ansible_error_code(
|
|
133
131
|
Invalid('Must be a string'), 'invalid-documentation')
|
|
134
132
|
errors = []
|
|
@@ -216,12 +214,12 @@ seealso_schema = Schema(
|
|
|
216
214
|
'description': doc_string,
|
|
217
215
|
},
|
|
218
216
|
{
|
|
219
|
-
Required('ref'):
|
|
217
|
+
Required('ref'): str,
|
|
220
218
|
Required('description'): doc_string,
|
|
221
219
|
},
|
|
222
220
|
{
|
|
223
|
-
Required('name'):
|
|
224
|
-
Required('link'):
|
|
221
|
+
Required('name'): str,
|
|
222
|
+
Required('link'): str,
|
|
225
223
|
Required('description'): doc_string,
|
|
226
224
|
},
|
|
227
225
|
),
|
|
@@ -238,7 +236,7 @@ argument_spec_modifiers = {
|
|
|
238
236
|
'required_together': sequence_of_sequences(min=2),
|
|
239
237
|
'required_one_of': sequence_of_sequences(min=2),
|
|
240
238
|
'required_if': sequence_of_sequences(min=3, max=4),
|
|
241
|
-
'required_by': Schema({str: Any(list_string_types, tuple_string_types,
|
|
239
|
+
'required_by': Schema({str: Any(list_string_types, tuple_string_types, str)}),
|
|
242
240
|
}
|
|
243
241
|
|
|
244
242
|
|
|
@@ -263,7 +261,7 @@ def options_with_apply_defaults(v):
|
|
|
263
261
|
def check_removal_version(v, version_field, collection_name_field, error_code='invalid-removal-version'):
|
|
264
262
|
version = v.get(version_field)
|
|
265
263
|
collection_name = v.get(collection_name_field)
|
|
266
|
-
if not isinstance(version,
|
|
264
|
+
if not isinstance(version, str) or not isinstance(collection_name, str):
|
|
267
265
|
# If they are not strings, schema validation will have already complained.
|
|
268
266
|
return v
|
|
269
267
|
if collection_name == 'ansible.builtin':
|
|
@@ -313,9 +311,8 @@ def option_deprecation(v):
|
|
|
313
311
|
|
|
314
312
|
|
|
315
313
|
def argument_spec_schema(for_collection):
|
|
316
|
-
any_string_types = Any(*string_types)
|
|
317
314
|
schema = {
|
|
318
|
-
|
|
315
|
+
str: {
|
|
319
316
|
'type': Any(is_callable, *argument_spec_types),
|
|
320
317
|
'elements': Any(*argument_spec_types),
|
|
321
318
|
'default': object,
|
|
@@ -336,12 +333,12 @@ def argument_spec_schema(for_collection):
|
|
|
336
333
|
'deprecated_aliases': Any([All(
|
|
337
334
|
Any(
|
|
338
335
|
{
|
|
339
|
-
Required('name'):
|
|
336
|
+
Required('name'): str,
|
|
340
337
|
Required('date'): date(),
|
|
341
338
|
Required('collection_name'): collection_name,
|
|
342
339
|
},
|
|
343
340
|
{
|
|
344
|
-
Required('name'):
|
|
341
|
+
Required('name'): str,
|
|
345
342
|
Required('version'): version(for_collection),
|
|
346
343
|
Required('collection_name'): collection_name,
|
|
347
344
|
},
|
|
@@ -353,13 +350,13 @@ def argument_spec_schema(for_collection):
|
|
|
353
350
|
)]),
|
|
354
351
|
}
|
|
355
352
|
}
|
|
356
|
-
schema[
|
|
353
|
+
schema[str].update(argument_spec_modifiers)
|
|
357
354
|
schemas = All(
|
|
358
355
|
schema,
|
|
359
|
-
Schema({
|
|
360
|
-
Schema({
|
|
361
|
-
Schema({
|
|
362
|
-
Schema({
|
|
356
|
+
Schema({str: no_required_with_default}),
|
|
357
|
+
Schema({str: elements_with_list}),
|
|
358
|
+
Schema({str: options_with_apply_defaults}),
|
|
359
|
+
Schema({str: option_deprecation}),
|
|
363
360
|
)
|
|
364
361
|
return Schema(schemas)
|
|
365
362
|
|
|
@@ -385,14 +382,15 @@ json_value = Schema(Any(
|
|
|
385
382
|
int,
|
|
386
383
|
float,
|
|
387
384
|
[Self],
|
|
388
|
-
|
|
385
|
+
{str: Self},
|
|
386
|
+
str,
|
|
389
387
|
))
|
|
390
388
|
|
|
391
389
|
|
|
392
390
|
def version_added(v, error_code='version-added-invalid', accept_historical=False):
|
|
393
391
|
if 'version_added' in v:
|
|
394
392
|
version_added = v.get('version_added')
|
|
395
|
-
if isinstance(version_added,
|
|
393
|
+
if isinstance(version_added, str):
|
|
396
394
|
# If it is not a string, schema validation will have already complained
|
|
397
395
|
# - or we have a float and we are in ansible/ansible, in which case we're
|
|
398
396
|
# also happy.
|
|
@@ -451,7 +449,7 @@ def get_type_checker(v):
|
|
|
451
449
|
elt_checker, elt_name = get_type_checker({'type': v.get('elements')})
|
|
452
450
|
|
|
453
451
|
def list_checker(value):
|
|
454
|
-
if isinstance(value,
|
|
452
|
+
if isinstance(value, str):
|
|
455
453
|
value = [unquote(x.strip()) for x in value.split(',')]
|
|
456
454
|
if not isinstance(value, list):
|
|
457
455
|
raise ValueError('Value must be a list')
|
|
@@ -482,14 +480,14 @@ def get_type_checker(v):
|
|
|
482
480
|
|
|
483
481
|
if v_type in ('str', 'string', 'path', 'tmp', 'temppath', 'tmppath'):
|
|
484
482
|
def str_checker(value):
|
|
485
|
-
if not isinstance(value,
|
|
483
|
+
if not isinstance(value, str):
|
|
486
484
|
raise ValueError('Value must be string')
|
|
487
485
|
|
|
488
486
|
return str_checker, v_type
|
|
489
487
|
|
|
490
488
|
if v_type in ('pathspec', 'pathlist'):
|
|
491
489
|
def path_list_checker(value):
|
|
492
|
-
if not isinstance(value,
|
|
490
|
+
if not isinstance(value, str) and not is_iterable(value):
|
|
493
491
|
raise ValueError('Value must be string or list of strings')
|
|
494
492
|
|
|
495
493
|
return path_list_checker, v_type
|
|
@@ -588,7 +586,7 @@ def list_dict_option_schema(for_collection, plugin_type):
|
|
|
588
586
|
'elements': element_types,
|
|
589
587
|
}
|
|
590
588
|
if plugin_type != 'module':
|
|
591
|
-
basic_option_schema['name'] =
|
|
589
|
+
basic_option_schema['name'] = str
|
|
592
590
|
deprecated_schema = All(
|
|
593
591
|
Schema(
|
|
594
592
|
All(
|
|
@@ -605,10 +603,10 @@ def list_dict_option_schema(for_collection, plugin_type):
|
|
|
605
603
|
},
|
|
606
604
|
{
|
|
607
605
|
# This definition makes sure that everything we require is there
|
|
608
|
-
Required('why'):
|
|
609
|
-
Required(Any('alternatives', 'alternative')):
|
|
610
|
-
Required(Any('removed_at_date', 'version')):
|
|
611
|
-
Required('collection_name'):
|
|
606
|
+
Required('why'): str,
|
|
607
|
+
Required(Any('alternatives', 'alternative')): str,
|
|
608
|
+
Required(Any('removed_at_date', 'version')): str,
|
|
609
|
+
Required('collection_name'): str,
|
|
612
610
|
},
|
|
613
611
|
),
|
|
614
612
|
extra=PREVENT_EXTRA
|
|
@@ -620,7 +618,7 @@ def list_dict_option_schema(for_collection, plugin_type):
|
|
|
620
618
|
)
|
|
621
619
|
env_schema = All(
|
|
622
620
|
Schema({
|
|
623
|
-
Required('name'):
|
|
621
|
+
Required('name'): str,
|
|
624
622
|
'deprecated': deprecated_schema,
|
|
625
623
|
'version_added': version(for_collection),
|
|
626
624
|
'version_added_collection': collection_name,
|
|
@@ -629,8 +627,8 @@ def list_dict_option_schema(for_collection, plugin_type):
|
|
|
629
627
|
)
|
|
630
628
|
ini_schema = All(
|
|
631
629
|
Schema({
|
|
632
|
-
Required('key'):
|
|
633
|
-
Required('section'):
|
|
630
|
+
Required('key'): str,
|
|
631
|
+
Required('section'): str,
|
|
634
632
|
'deprecated': deprecated_schema,
|
|
635
633
|
'version_added': version(for_collection),
|
|
636
634
|
'version_added_collection': collection_name,
|
|
@@ -639,7 +637,7 @@ def list_dict_option_schema(for_collection, plugin_type):
|
|
|
639
637
|
)
|
|
640
638
|
vars_schema = All(
|
|
641
639
|
Schema({
|
|
642
|
-
Required('name'):
|
|
640
|
+
Required('name'): str,
|
|
643
641
|
'deprecated': deprecated_schema,
|
|
644
642
|
'version_added': version(for_collection),
|
|
645
643
|
'version_added_collection': collection_name,
|
|
@@ -648,8 +646,8 @@ def list_dict_option_schema(for_collection, plugin_type):
|
|
|
648
646
|
)
|
|
649
647
|
cli_schema = All(
|
|
650
648
|
Schema({
|
|
651
|
-
Required('name'):
|
|
652
|
-
'option':
|
|
649
|
+
Required('name'): str,
|
|
650
|
+
'option': str,
|
|
653
651
|
'deprecated': deprecated_schema,
|
|
654
652
|
'version_added': version(for_collection),
|
|
655
653
|
'version_added_collection': collection_name,
|
|
@@ -658,7 +656,7 @@ def list_dict_option_schema(for_collection, plugin_type):
|
|
|
658
656
|
)
|
|
659
657
|
keyword_schema = All(
|
|
660
658
|
Schema({
|
|
661
|
-
Required('name'):
|
|
659
|
+
Required('name'): str,
|
|
662
660
|
'deprecated': deprecated_schema,
|
|
663
661
|
'version_added': version(for_collection),
|
|
664
662
|
'version_added_collection': collection_name,
|
|
@@ -677,7 +675,7 @@ def list_dict_option_schema(for_collection, plugin_type):
|
|
|
677
675
|
suboption_schema = dict(basic_option_schema)
|
|
678
676
|
suboption_schema.update({
|
|
679
677
|
# Recursive suboptions
|
|
680
|
-
'suboptions': Any(None,
|
|
678
|
+
'suboptions': Any(None, {str: Self}),
|
|
681
679
|
})
|
|
682
680
|
suboption_schema = Schema(All(
|
|
683
681
|
suboption_schema,
|
|
@@ -686,13 +684,9 @@ def list_dict_option_schema(for_collection, plugin_type):
|
|
|
686
684
|
check_option_default,
|
|
687
685
|
), extra=PREVENT_EXTRA)
|
|
688
686
|
|
|
689
|
-
# This generates list of dicts with keys from string_types and suboption_schema value
|
|
690
|
-
# for example in Python 3: {str: suboption_schema}
|
|
691
|
-
list_dict_suboption_schema = [{str_type: suboption_schema} for str_type in string_types]
|
|
692
|
-
|
|
693
687
|
option_schema = dict(basic_option_schema)
|
|
694
688
|
option_schema.update({
|
|
695
|
-
'suboptions': Any(None,
|
|
689
|
+
'suboptions': Any(None, {str: suboption_schema}),
|
|
696
690
|
})
|
|
697
691
|
option_schema = Schema(All(
|
|
698
692
|
option_schema,
|
|
@@ -703,20 +697,18 @@ def list_dict_option_schema(for_collection, plugin_type):
|
|
|
703
697
|
|
|
704
698
|
option_version_added = Schema(
|
|
705
699
|
All({
|
|
706
|
-
'suboptions': Any(None,
|
|
700
|
+
'suboptions': Any(None, {str: Self}),
|
|
707
701
|
}, partial(version_added, error_code='option-invalid-version-added')),
|
|
708
702
|
extra=ALLOW_EXTRA
|
|
709
703
|
)
|
|
710
704
|
|
|
711
|
-
|
|
712
|
-
# for example in Python 3: {str: option_schema}
|
|
713
|
-
return [{str_type: All(option_schema, option_version_added)} for str_type in string_types]
|
|
705
|
+
return [{str: All(option_schema, option_version_added)}]
|
|
714
706
|
|
|
715
707
|
|
|
716
708
|
def return_contains(v):
|
|
717
709
|
schema = Schema(
|
|
718
710
|
{
|
|
719
|
-
Required('contains'): Any(dict, list,
|
|
711
|
+
Required('contains'): Any(dict, list, str)
|
|
720
712
|
},
|
|
721
713
|
extra=ALLOW_EXTRA
|
|
722
714
|
)
|
|
@@ -752,7 +744,7 @@ def return_schema(for_collection, plugin_type='module'):
|
|
|
752
744
|
|
|
753
745
|
inner_return_option_schema = dict(basic_return_option_schema)
|
|
754
746
|
inner_return_option_schema.update({
|
|
755
|
-
'contains': Any(None,
|
|
747
|
+
'contains': Any(None, {str: Self}),
|
|
756
748
|
})
|
|
757
749
|
return_contains_schema = Any(
|
|
758
750
|
All(
|
|
@@ -763,27 +755,23 @@ def return_schema(for_collection, plugin_type='module'):
|
|
|
763
755
|
Schema(type(None)),
|
|
764
756
|
)
|
|
765
757
|
|
|
766
|
-
# This generates list of dicts with keys from string_types and return_contains_schema value
|
|
767
|
-
# for example in Python 3: {str: return_contains_schema}
|
|
768
|
-
list_dict_return_contains_schema = [{str_type: return_contains_schema} for str_type in string_types]
|
|
769
|
-
|
|
770
758
|
return_option_schema = dict(basic_return_option_schema)
|
|
771
759
|
return_option_schema.update({
|
|
772
|
-
'contains': Any(None,
|
|
760
|
+
'contains': Any(None, {str: return_contains_schema}),
|
|
773
761
|
})
|
|
774
762
|
if plugin_type == 'module':
|
|
775
763
|
# 'returned' is required on top-level
|
|
776
764
|
del return_option_schema['returned']
|
|
777
|
-
return_option_schema[Required('returned')] =
|
|
765
|
+
return_option_schema[Required('returned')] = str
|
|
778
766
|
return Any(
|
|
779
767
|
All(
|
|
780
768
|
Schema(
|
|
781
769
|
{
|
|
782
|
-
|
|
770
|
+
str: return_option_schema
|
|
783
771
|
}
|
|
784
772
|
),
|
|
785
|
-
Schema({
|
|
786
|
-
Schema({
|
|
773
|
+
Schema({str: return_contains}),
|
|
774
|
+
Schema({str: partial(version_added, error_code='option-invalid-version-added')}),
|
|
787
775
|
),
|
|
788
776
|
Schema(type(None)),
|
|
789
777
|
)
|
|
@@ -840,7 +828,7 @@ def author(value):
|
|
|
840
828
|
value = [value]
|
|
841
829
|
|
|
842
830
|
for line in value:
|
|
843
|
-
if not isinstance(line,
|
|
831
|
+
if not isinstance(line, str):
|
|
844
832
|
continue # let schema checks handle
|
|
845
833
|
m = author_line.search(line)
|
|
846
834
|
if not m:
|
|
@@ -868,14 +856,14 @@ def doc_schema(module_name, for_collection=False, deprecated_module=False, plugi
|
|
|
868
856
|
'requirements': [doc_string],
|
|
869
857
|
'todo': Any(None, doc_string_or_strings),
|
|
870
858
|
'options': Any(None, *list_dict_option_schema(for_collection, plugin_type)),
|
|
871
|
-
'extends_documentation_fragment': Any(list_string_types,
|
|
859
|
+
'extends_documentation_fragment': Any(list_string_types, str),
|
|
872
860
|
'version_added_collection': collection_name,
|
|
873
861
|
}
|
|
874
862
|
if plugin_type == 'module':
|
|
875
|
-
doc_schema_dict[Required('author')] = All(Any(None, list_string_types,
|
|
863
|
+
doc_schema_dict[Required('author')] = All(Any(None, list_string_types, str), author)
|
|
876
864
|
else:
|
|
877
865
|
# author is optional for plugins (for now)
|
|
878
|
-
doc_schema_dict['author'] = All(Any(None, list_string_types,
|
|
866
|
+
doc_schema_dict['author'] = All(Any(None, list_string_types, str), author)
|
|
879
867
|
if plugin_type == 'callback':
|
|
880
868
|
doc_schema_dict[Required('type')] = Any('aggregate', 'notification', 'stdout')
|
|
881
869
|
|
|
@@ -896,9 +884,9 @@ def doc_schema(module_name, for_collection=False, deprecated_module=False, plugi
|
|
|
896
884
|
schema = {
|
|
897
885
|
'description': doc_string_or_strings,
|
|
898
886
|
'details': doc_string_or_strings,
|
|
899
|
-
'support':
|
|
900
|
-
'version_added_collection':
|
|
901
|
-
'version_added':
|
|
887
|
+
'support': str,
|
|
888
|
+
'version_added_collection': str,
|
|
889
|
+
'version_added': str,
|
|
902
890
|
}
|
|
903
891
|
if more:
|
|
904
892
|
schema.update(more)
|
|
@@ -907,7 +895,7 @@ def doc_schema(module_name, for_collection=False, deprecated_module=False, plugi
|
|
|
907
895
|
doc_schema_dict['attributes'] = Schema(
|
|
908
896
|
All(
|
|
909
897
|
Schema({
|
|
910
|
-
|
|
898
|
+
str: {
|
|
911
899
|
Required('description'): doc_string_or_strings,
|
|
912
900
|
Required('support'): Any('full', 'partial', 'none', 'N/A'),
|
|
913
901
|
'details': doc_string_or_strings,
|
|
@@ -917,12 +905,12 @@ def doc_schema(module_name, for_collection=False, deprecated_module=False, plugi
|
|
|
917
905
|
}, extra=ALLOW_EXTRA),
|
|
918
906
|
partial(version_added, error_code='attribute-invalid-version-added', accept_historical=False),
|
|
919
907
|
Schema({
|
|
920
|
-
|
|
908
|
+
str: add_default_attributes(),
|
|
921
909
|
'action_group': add_default_attributes({
|
|
922
910
|
Required('membership'): list_string_types,
|
|
923
911
|
}),
|
|
924
912
|
'platform': add_default_attributes({
|
|
925
|
-
Required('platforms'): Any(list_string_types,
|
|
913
|
+
Required('platforms'): Any(list_string_types, str)
|
|
926
914
|
}),
|
|
927
915
|
}, extra=PREVENT_EXTRA),
|
|
928
916
|
)
|
|
@@ -31,7 +31,6 @@ import yaml.reader
|
|
|
31
31
|
from ansible.module_utils.common.text.converters import to_text
|
|
32
32
|
from ansible.module_utils.basic import AnsibleModule
|
|
33
33
|
from ansible.module_utils.common.yaml import SafeLoader
|
|
34
|
-
from ansible.module_utils.six import string_types
|
|
35
34
|
from ansible.parsing.yaml.loader import AnsibleLoader
|
|
36
35
|
|
|
37
36
|
|
|
@@ -211,7 +210,7 @@ def parse_isodate(v, allow_date):
|
|
|
211
210
|
msg = 'Expected ISO 8601 date string (YYYY-MM-DD) or YAML date'
|
|
212
211
|
else:
|
|
213
212
|
msg = 'Expected ISO 8601 date string (YYYY-MM-DD)'
|
|
214
|
-
if not isinstance(v,
|
|
213
|
+
if not isinstance(v, str):
|
|
215
214
|
raise ValueError(msg)
|
|
216
215
|
# From Python 3.7 in, there is datetime.date.fromisoformat(). For older versions,
|
|
217
216
|
# we have to do things manually.
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
from __future__ import annotations
|
|
8
8
|
|
|
9
|
+
import importlib
|
|
9
10
|
import os
|
|
10
11
|
import sys
|
|
11
12
|
|
|
@@ -29,8 +30,9 @@ def main(args=None):
|
|
|
29
30
|
if any(not os.get_blocking(handle.fileno()) for handle in (sys.stdin, sys.stdout, sys.stderr)):
|
|
30
31
|
raise SystemExit('Standard input, output and error file handles must be blocking to run ansible-test.')
|
|
31
32
|
|
|
32
|
-
#
|
|
33
|
-
|
|
33
|
+
# avoid using import to hide it from mypy
|
|
34
|
+
internal = importlib.import_module('ansible_test._internal')
|
|
35
|
+
cli_main = getattr(internal, 'main')
|
|
34
36
|
|
|
35
37
|
cli_main(args)
|
|
36
38
|
|
|
@@ -187,12 +187,6 @@ bootstrap_remote_freebsd()
|
|
|
187
187
|
# Declare platform/python version combinations which do not have supporting OS packages available.
|
|
188
188
|
# For these combinations ansible-test will use pip to install the requirements instead.
|
|
189
189
|
case "${platform_version}/${python_version}" in
|
|
190
|
-
13.5/3.11)
|
|
191
|
-
# defaults available
|
|
192
|
-
;;
|
|
193
|
-
14.2/3.11)
|
|
194
|
-
# defaults available
|
|
195
|
-
;;
|
|
196
190
|
*)
|
|
197
191
|
# just assume nothing is available
|
|
198
192
|
jinja2_pkg="" # not available
|
ansible/utils/py3compat.py
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
#
|
|
3
|
-
# (c) 2018, Toshio Kuratomi <a.badger@gmail.com>
|
|
4
|
-
# Copyright: Contributors to the Ansible project
|
|
5
|
-
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
6
|
-
|
|
7
|
-
from __future__ import annotations
|
|
8
|
-
|
|
9
|
-
import os
|
|
10
|
-
|
|
11
|
-
from ansible.utils.display import Display
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
display = Display()
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def __getattr__(name):
|
|
18
|
-
if name != 'environ':
|
|
19
|
-
raise AttributeError(name)
|
|
20
|
-
|
|
21
|
-
display.deprecated(
|
|
22
|
-
msg='`ansible.utils.py3compat.environ` is deprecated.',
|
|
23
|
-
version='2.20',
|
|
24
|
-
help_text='Use `os.environ` from the Python standard library instead.',
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
return os.environ
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|