diff options
author | Brian Coca <bcoca@users.noreply.github.com> | 2023-05-01 10:20:08 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-01 10:20:08 -0400 |
commit | 06dcb4ad7a252315ba6dc38b3d46e82ba5ea2c40 (patch) | |
tree | 45729014069286b73a0d94f67552076e11f6db82 | |
parent | 1568f07b220e70b8c62e844ccb2939da1cd9a90e (diff) | |
download | ansible-06dcb4ad7a252315ba6dc38b3d46e82ba5ea2c40.tar.gz |
Don't include a default for cli as it overrides config with lesser pr… (#80650)
* Don't include a default for CLI as it overrides config with lesser precedence
connection plugins should already use the same config entries (and more)
than DEFAULT_TIMEOUT.
-rw-r--r-- | changelogs/fragments/timeout_config_fix.yml | 5 | ||||
-rw-r--r-- | lib/ansible/cli/arguments/option_helpers.py | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/changelogs/fragments/timeout_config_fix.yml b/changelogs/fragments/timeout_config_fix.yml new file mode 100644 index 0000000000..5cebe81bf6 --- /dev/null +++ b/changelogs/fragments/timeout_config_fix.yml @@ -0,0 +1,5 @@ +bugfixes: + - connection timeouts defined in ansible.cfg will now be properly used, the --timeout cli option was obscuring them by always being set. +breaking_changes: + - Any plugin using the config system and the `cli` entry to use the `timeout` from the command line, will see the value change if the use had configured it in any of the lower precedence methods. + If relying on this behaviour to consume the global/generic timeout from the DEFAULT_TIMEOUT constant, please consult the documentation on plugin configuration to add the overlaping entries. diff --git a/lib/ansible/cli/arguments/option_helpers.py b/lib/ansible/cli/arguments/option_helpers.py index a3efb1e268..e3f661111f 100644 --- a/lib/ansible/cli/arguments/option_helpers.py +++ b/lib/ansible/cli/arguments/option_helpers.py @@ -250,8 +250,8 @@ def add_connect_options(parser): help='connect as this user (default=%s)' % C.DEFAULT_REMOTE_USER) connect_group.add_argument('-c', '--connection', dest='connection', default=C.DEFAULT_TRANSPORT, help="connection type to use (default=%s)" % C.DEFAULT_TRANSPORT) - connect_group.add_argument('-T', '--timeout', default=C.DEFAULT_TIMEOUT, type=int, dest='timeout', - help="override the connection timeout in seconds (default=%s)" % C.DEFAULT_TIMEOUT) + connect_group.add_argument('-T', '--timeout', default=None, type=int, dest='timeout', + help="override the connection timeout in seconds (default depends on connection)") # ssh only connect_group.add_argument('--ssh-common-args', default=None, dest='ssh_common_args', |