Fix missing await and async def

Fixes #66592
This commit is contained in:
Tim Hetkämper 2024-05-30 22:27:02 +02:00 committed by Daniel Wozniak
parent 1c5b03f7be
commit edd5e2e4dd
2 changed files with 11 additions and 11 deletions

View file

@ -1152,7 +1152,7 @@ class MinionManager(MinionBase):
minion.setup_scheduler(before_connect=True)
if minion.opts.get("master_type", "str") != "disable":
yield minion.connect_master(failed=failed)
minion.tune_in(start=False)
yield minion.tune_in(start=False)
self.minions.append(minion)
break
except SaltClientError as exc:
@ -2481,7 +2481,7 @@ class Minion(MinionBase):
log.trace("ret_val = %s", ret_val) # pylint: disable=no-member
return ret_val
def _state_run(self):
async def _state_run(self):
"""
Execute a state run based on information set in the minion config file
"""
@ -2506,7 +2506,7 @@ class Minion(MinionBase):
else:
data["fun"] = "state.highstate"
data["arg"] = []
self._handle_decoded_payload(data)
await self._handle_decoded_payload(data)
def _refresh_grains_watcher(self, refresh_interval_in_minutes):
"""
@ -3209,7 +3209,7 @@ class Minion(MinionBase):
return True
# Main Minion Tune In
def tune_in(self, start=True):
async def tune_in(self, start=True):
"""
Lock onto the publisher. This is the main event loop for the minion
:rtype : None
@ -3236,7 +3236,7 @@ class Minion(MinionBase):
salt.utils.win_functions.enable_ctrl_logoff_handler()
# On first startup execute a state run if configured to do so
self._state_run()
await self._state_run()
self.setup_beacons()
self.setup_scheduler()

View file

@ -490,7 +490,7 @@ def test_process_count_max(minion_opts):
@pytest.mark.slow_test
def test_beacons_before_connect(minion_opts):
async def test_beacons_before_connect(minion_opts):
"""
Tests that the 'beacons_before_connect' option causes the beacons to be initialized before connect.
"""
@ -511,7 +511,7 @@ def test_beacons_before_connect(minion_opts):
try:
try:
minion.tune_in(start=True)
await minion.tune_in(start=True)
except RuntimeError:
pass
@ -523,7 +523,7 @@ def test_beacons_before_connect(minion_opts):
@pytest.mark.slow_test
def test_scheduler_before_connect(minion_opts):
async def test_scheduler_before_connect(minion_opts):
"""
Tests that the 'scheduler_before_connect' option causes the scheduler to be initialized before connect.
"""
@ -543,7 +543,7 @@ def test_scheduler_before_connect(minion_opts):
minion = salt.minion.Minion(minion_opts, io_loop=io_loop)
try:
try:
minion.tune_in(start=True)
await minion.tune_in(start=True)
except RuntimeError:
pass
@ -613,7 +613,7 @@ def test_minion_module_refresh_beacons_refresh(minion_opts):
@pytest.mark.slow_test
def test_when_ping_interval_is_set_the_callback_should_be_added_to_periodic_callbacks(
async def test_when_ping_interval_is_set_the_callback_should_be_added_to_periodic_callbacks(
minion_opts,
):
with patch("salt.minion.Minion.ctx", MagicMock(return_value={})), patch(
@ -634,7 +634,7 @@ def test_when_ping_interval_is_set_the_callback_should_be_added_to_periodic_call
try:
minion.connected = MagicMock(side_effect=(False, True))
minion._fire_master_minion_start = MagicMock()
minion.tune_in(start=False)
await minion.tune_in(start=False)
except RuntimeError:
pass