Giter Club home page Giter Club logo

Comments (6)

transistortim avatar transistortim commented on July 1, 2024 2

I can confirm this happening on all our minions (Debian and Windows) after having upgraded to 3007.1.

The log contains the same message as reported above, enabling tracemalloc reveals the corresponding code line:

root@minion ~ 
# export PYTHONTRACEMALLOC=1
root@minion ~ 
# salt-minion -l debug
[ ... some more debug messages ...]
[INFO    ] Minion is ready to receive requests!
/opt/saltstack/salt/lib/python3.10/site-packages/salt/minion.py:2434: RuntimeWarning: coroutine 'Minion._handle_decoded_payload' was never awaited
  self._handle_decoded_payload(data)
Object allocated at (most recent call last):
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/minion.py", lineno 2434
    self._handle_decoded_payload(data)

The corresponding code block

self._handle_decoded_payload(data)
parses the startup_states option and fails to do so because of the missing await.
Adding await requires making the calling functions async. By manually fixing /opt/saltstack/salt/lib/python3.10/site-packages/salt/minion.py with the changes below highstating works as expected.

Changes:

diff --git a/minion_old.py b/minion.py
index 68733a5..a4ebbe3 100644
--- a/minion_old.py
+++ b/minion.py
@@ -1144,7 +1144,7 @@ class MinionManager(MinionBase):
                     minion.setup_scheduler(before_connect=True)
                 if minion.opts.get("master_type", "str") != "disable":
                     await minion.connect_master(failed=failed)
-                minion.tune_in(start=False)
+                await minion.tune_in(start=False)
                 self.minions.append(minion)
                 break
             except SaltClientError as exc:
@@ -2406,7 +2406,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
         """
@@ -2431,7 +2431,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):
         """
@@ -3110,7 +3110,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
@@ -3137,7 +3137,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()

from salt.

iMikeG6 avatar iMikeG6 commented on July 1, 2024 1

Hi there,

we also have the same issue with the version 3007.1 on all of our minions. startup_states: highstate is not working anymore.

from salt.

transistortim avatar transistortim commented on July 1, 2024

If anyone is looking for a workaround:
We enabled salt's reactor with the example from the docs adapted slightly.

root@master ~
# cat /etc/salt/master.d/reactor.conf 
reactor:
  - 'salt/minion/*/start':          # Match tag "salt/minion/*/start"
    - /srv/reactor/start.sls        # Things to do when a minion starts
root@master ~
# cat /srv/reactor/start.sls 
highstate_run:
  local.state.apply:
    - tgt: {{ data['id'] }}

from salt.

iMikeG6 avatar iMikeG6 commented on July 1, 2024

Thanks @transistortim,

this also worked for us.

Nice workaround.

If anyone is looking for a workaround: We enabled salt's reactor with the example from the docs adapted slightly.

root@master ~
# cat /etc/salt/master.d/reactor.conf 
reactor:
  - 'salt/minion/*/start':          # Match tag "salt/minion/*/start"
    - /srv/reactor/start.sls        # Things to do when a minion starts
root@master ~
# cat /srv/reactor/start.sls 
highstate_run:
  local.state.apply:
    - tgt: {{ data['id'] }}

from salt.

jfduque avatar jfduque commented on July 1, 2024

Can confirm that this also happens when using startup_states: 'sls'. I'm using 3007.1

from salt.

bgdnlp avatar bgdnlp commented on July 1, 2024

Confirmed here too. Which, in our case, means that new machines will not be configured properly and that messes up our deployments.

from salt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.