issue #587: 2.8 PlayContext lacks sudo_flags attribute.

This is a huge bodge.
This commit is contained in:
David Wilson 2019-05-26 12:06:14 +01:00
parent e11b251c75
commit c1c8d5c31e
2 changed files with 5 additions and 4 deletions

View File

@ -276,8 +276,8 @@ class StrategyMixin(object):
class_only=True,
)
if play_context.connection is not Sentinel:
# 2.8 appears to defer computing this value until it's inside the
# worker. TODO: figure out where this value has moved.
# 2.8 appears to defer computing this until inside the worker.
# TODO: figure out where it has moved.
ansible_mitogen.loaders.connection_loader.get(
name=play_context.connection,
class_only=True,

View File

@ -380,8 +380,9 @@ class PlayContextSpec(Spec):
for term in ansible.utils.shlex.shlex_split(
first_true((
self._play_context.become_flags,
self._play_context.sudo_flags,
# Ansible 2.3.
# Ansible <=2.7.
getattr(self._play_context, 'sudo_flags', ''),
# Ansible <=2.3.
getattr(C, 'DEFAULT_BECOME_FLAGS', ''),
getattr(C, 'DEFAULT_SUDO_FLAGS', '')
), default='')