fix configurable pipelining (#69920)
* fix configurable pipelining Co-authored-by: Sloane Hertel <shertel@redhat.com>
This commit is contained in:
parent
4a4a11d282
commit
8c3eb7ae4a
3 changed files with 28 additions and 16 deletions
2
changelogs/fragments/configurable_pipelining.yml
Normal file
2
changelogs/fragments/configurable_pipelining.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- match docs for ssh and ensure pipelining is configurable per connection plugin.
|
|
@ -300,20 +300,30 @@ class ActionBase(with_metaclass(ABCMeta, object)):
|
|||
Determines if we are required and can do pipelining
|
||||
'''
|
||||
|
||||
# any of these require a true
|
||||
for condition in [
|
||||
self._connection.has_pipelining,
|
||||
self._play_context.pipelining or self._connection.always_pipeline_modules, # pipelining enabled for play or connection requires it (eg winrm)
|
||||
module_style == "new", # old style modules do not support pipelining
|
||||
not C.DEFAULT_KEEP_REMOTE_FILES, # user wants remote files
|
||||
not wrap_async or self._connection.always_pipeline_modules, # async does not normally support pipelining unless it does (eg winrm)
|
||||
(self._connection.become.name if self._connection.become else '') != 'su', # su does not work with pipelining,
|
||||
# FIXME: we might need to make become_method exclusion a configurable list
|
||||
]:
|
||||
if not condition:
|
||||
return False
|
||||
try:
|
||||
is_enabled = self._connection.get_option('pipelining')
|
||||
except (KeyError, AttributeError, ValueError):
|
||||
is_enabled = self._play_context.pipelining
|
||||
|
||||
return True
|
||||
# winrm supports async pipeline
|
||||
# TODO: make other class property 'has_async_pipelining' to separate cases
|
||||
always_pipeline = self._connection.always_pipeline_modules
|
||||
|
||||
# su does not work with pipelining
|
||||
# TODO: add has_pipelining class prop to become plugins
|
||||
become_exception = (self._connection.become.name if self._connection.become else '') != 'su'
|
||||
|
||||
# any of these require a true
|
||||
conditions = [
|
||||
self._connection.has_pipelining, # connection class supports it
|
||||
is_enabled or always_pipeline, # enabled via config or forced via connection (eg winrm)
|
||||
module_style == "new", # old style modules do not support pipelining
|
||||
not C.DEFAULT_KEEP_REMOTE_FILES, # user wants remote files
|
||||
not wrap_async or always_pipeline, # async does not normally support pipelining unless it does (eg winrm)
|
||||
become_exception,
|
||||
]
|
||||
|
||||
return all(conditions)
|
||||
|
||||
def _get_admin_users(self):
|
||||
'''
|
||||
|
|
|
@ -200,12 +200,12 @@ DOCUMENTATION = '''
|
|||
which is why this feature is disabled by default.
|
||||
env:
|
||||
- name: ANSIBLE_PIPELINING
|
||||
#- name: ANSIBLE_SSH_PIPELINING
|
||||
- name: ANSIBLE_SSH_PIPELINING
|
||||
ini:
|
||||
- section: defaults
|
||||
key: pipelining
|
||||
#- section: ssh_connection
|
||||
# key: pipelining
|
||||
- section: ssh_connection
|
||||
key: pipelining
|
||||
type: boolean
|
||||
vars:
|
||||
- name: ansible_pipelining
|
||||
|
|
Loading…
Reference in a new issue