saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Install Salt from the Salt package repositories here:
https://docs.saltproject.io/salt/install-guide/en/latest/
Apache License 2.0
14.21k stars 5.48k forks source link

[BUG] Minion main tune_in() "start" block never reached ? #67016

Open amalaguti opened 3 weeks ago

amalaguti commented 3 weeks ago

Description While troubleshooting issue #66932, and debugging minion.py connection setup on Windows, realized that apparently the main minion tune_in() function is never called with start: True. Maybe I'm mssing something but just wanted to call the attention to review this code to see if there's anything broken affecting minion setup/connection, or it's just redundant, orphaned code that can be removed to clean up stuff

The minion.tune_in() function seems to be called from async def _connect_minion(self, minion), which seems to be taking care of the beacons/scheduler_before_connect setup part. But it's called with start=False

    # Main Minion Tune In
    def tune_in(self, start=True):
        """
        Lock onto the publisher. This is the main event loop for the minion
        :rtype : None
        """
        self._pre_tune()

        log.debug("Minion '%s' trying to tune in", self.opts["id"])

        if start:
            if self.opts.get("beacons_before_connect", False):
                self.setup_beacons(before_connect=True)
            if self.opts.get("scheduler_before_connect", False):
                self.setup_scheduler(before_connect=True)
            self.sync_connect_master()
        if self.connected:
            self._fire_master_minion_start()
            log.info("Minion is ready to receive requests!")

https://github.com/saltstack/salt/blob/master/salt/minion.py#L3107-L3126

Setup 3007.1 minion.py on Windows