fixed tests, and removed the action hack code
This commit is contained in:
parent
7411057ba8
commit
33e7d0804f
|
@ -504,9 +504,7 @@ class Connection(ansible.plugins.connection.ConnectionBase):
|
|||
loader_basedir = None
|
||||
|
||||
# set by `_get_task_vars()` for interpreter discovery
|
||||
# we need it to be an object with the value of "_finding_python_interpreter" in case we aren't
|
||||
# running interpreter discovery fully
|
||||
_action = type(str('actionTemp'), (object,), {'_finding_python_interpreter': False})
|
||||
_action = None
|
||||
|
||||
def __del__(self):
|
||||
"""
|
||||
|
@ -778,7 +776,6 @@ class Connection(ansible.plugins.connection.ConnectionBase):
|
|||
play_context=self._play_context,
|
||||
transport=self.transport,
|
||||
inventory_name=self.get_task_var('inventory_hostname'),
|
||||
action=self._action
|
||||
)
|
||||
stack = self._stack_from_spec(spec)
|
||||
return spec.inventory_name(), stack
|
||||
|
|
|
@ -397,14 +397,14 @@ class PlayContextSpec(Spec):
|
|||
PlayContext. It is used for normal connections and delegate_to connections,
|
||||
and should always be accurate.
|
||||
"""
|
||||
def __init__(self, connection, play_context, transport, inventory_name, action):
|
||||
def __init__(self, connection, play_context, transport, inventory_name):
|
||||
self._connection = connection
|
||||
self._play_context = play_context
|
||||
self._transport = transport
|
||||
self._inventory_name = inventory_name
|
||||
self._task_vars = self._connection._get_task_vars()
|
||||
# used to run interpreter discovery
|
||||
self._action = action
|
||||
self._action = connection._action
|
||||
|
||||
def transport(self):
|
||||
return self._transport
|
||||
|
|
|
@ -47,11 +47,15 @@ class ConnectionMixin(MuxProcessMixin):
|
|||
def make_connection(self):
|
||||
play_context = ansible.playbook.play_context.PlayContext()
|
||||
conn = self.klass(play_context, new_stdin=False)
|
||||
# conn functions don't fetch ActionModuleMixin objs from _get_task_vars()
|
||||
# through the usual walk-the-stack approach so we'll not run interpreter discovery here
|
||||
conn._action = mock.MagicMock(_possible_python_interpreter='/usr/bin/python')
|
||||
conn.on_action_run(
|
||||
task_vars={},
|
||||
delegate_to_hostname=None,
|
||||
loader_basedir=None,
|
||||
)
|
||||
|
||||
return conn
|
||||
|
||||
def wait_for_completion(self):
|
||||
|
|
Loading…
Reference in New Issue