mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -07:00
Remove workaround for fixed bug. (#15340)
* Remove workaround for fixed bug. The bug where PluginLoader required objects to directly inherit from base_classes has been fixed. Remove workaround from this strategy plugin Also switched to using super so that we don't have to modify all of hte code anytime something like that happens. * These should be to_uniocde because they're being sent to display()
This commit is contained in:
parent
005dc84aa7
commit
54acdd7ead
2 changed files with 10 additions and 14 deletions
|
@ -7,7 +7,6 @@ import pprint
|
|||
import sys
|
||||
|
||||
from ansible.plugins.strategy import linear
|
||||
from ansible.plugins.strategy import StrategyBase
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
|
@ -26,13 +25,10 @@ class NextAction(object):
|
|||
self.result = result
|
||||
|
||||
|
||||
class StrategyModule(linear.StrategyModule, StrategyBase):
|
||||
# Usually inheriting linear.StrategyModule is enough. However, StrategyBase class must be
|
||||
# direct ancestor to be considered as strategy plugin, and so we inherit the class here.
|
||||
|
||||
class StrategyModule(linear.StrategyModule):
|
||||
def __init__(self, tqm):
|
||||
self.curr_tqm = tqm
|
||||
StrategyBase.__init__(self, tqm)
|
||||
super(StrategyModule, self).__init__(tqm)
|
||||
|
||||
def _queue_task(self, host, task, task_vars, play_context):
|
||||
self.curr_host = host
|
||||
|
@ -40,14 +36,14 @@ class StrategyModule(linear.StrategyModule, StrategyBase):
|
|||
self.curr_task_vars = task_vars
|
||||
self.curr_play_context = play_context
|
||||
|
||||
StrategyBase._queue_task(self, host, task, task_vars, play_context)
|
||||
super(StrategyModule, self)._queue_task(host, task, task_vars, play_context)
|
||||
|
||||
def _process_pending_results(self, iterator, one_pass=False):
|
||||
if not hasattr(self, "curr_host"):
|
||||
return StrategyBase._process_pending_results(self, iterator, one_pass)
|
||||
return super(StrategyModule, self)._process_pending_results(iterator, one_pass)
|
||||
|
||||
prev_host_state = iterator.get_host_state(self.curr_host)
|
||||
results = StrategyBase._process_pending_results(self, iterator, one_pass)
|
||||
results = super(StrategyModule, self)._process_pending_results(iterator, one_pass)
|
||||
|
||||
while self._need_debug(results):
|
||||
next_action = NextAction()
|
||||
|
@ -64,8 +60,8 @@ class StrategyModule(linear.StrategyModule, StrategyBase):
|
|||
self._tqm._stats.dark[self.curr_host.name] -= 1
|
||||
|
||||
# redo
|
||||
StrategyBase._queue_task(self, self.curr_host, self.curr_task, self.curr_task_vars, self.curr_play_context)
|
||||
results = StrategyBase._process_pending_results(self, iterator, one_pass)
|
||||
super(StrategyModule, self)._queue_task(self.curr_host, self.curr_task, self.curr_task_vars, self.curr_play_context)
|
||||
results = super(StrategyModule, self)._process_pending_results(iterator, one_pass)
|
||||
elif next_action.result == NextAction.CONTINUE:
|
||||
break
|
||||
elif next_action.result == NextAction.EXIT:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue