Description
A minion configured for all-hot multi-master (a master: list with the default master_type: str) logs the following warning once per master at every startup:
random_master is True but there is only one master specified. Ignoring.
even though random_master is a valid, documented setting for that configuration.
master: list + random_master: True is a documented combination:
- The Multi-Master Tutorial describes all-hot multi-master ("all masters are running hot, and any active master can be used to send commands out to the minions"), configured with a
master: list.
random_master is documented, with a master: list, to shuffle it on startup "to distribute the load of many minions executing salt-call requests, for example, from a cron job."
The warning is intended only for the single-master case, where random_master genuinely has no effect.
Root cause
In multi-master mode, MinionManager._spawn_minions (salt/minion.py) creates one Minion per master, each bound to a single master via s_opts["master"] = master but inheriting the operator's random_master setting (and flagged with s_opts["multimaster"] = True). Each child then takes the single-master branch of eval_master and emits the warning. With N masters, the warning appears N times at startup.
Setup
- on-prem / VM, onedir packaging
- minion connected to two masters
Steps to Reproduce the behavior
Minion config:
master:
- master1.example.com
- master2.example.com
random_master: True
Restart the minion and check the log:
# grep random_master /var/log/salt/minion
... random_master is True but there is only one master specified. Ignoring.
... random_master is True but there is only one master specified. Ignoring.
Expected behavior
No warning for a valid multi-master configuration. The warning should fire only for a genuinely single-master minion (one where random_master truly has no effect), not for the per-master child minions the MinionManager spawns in multi-master mode.
Versions Report
Observed on 3006.26. The warning code is unguarded on the current 3006.x branch and on master (the else "single master sign in" branch of MinionBase.eval_master).
Description
A minion configured for all-hot multi-master (a
master:list with the defaultmaster_type: str) logs the following warning once per master at every startup:even though
random_masteris a valid, documented setting for that configuration.master:list +random_master: Trueis a documented combination:master:list.random_masteris documented, with amaster:list, to shuffle it on startup "to distribute the load of many minions executingsalt-callrequests, for example, from a cron job."The warning is intended only for the single-master case, where
random_mastergenuinely has no effect.Root cause
In multi-master mode,
MinionManager._spawn_minions(salt/minion.py) creates oneMinionper master, each bound to a single master vias_opts["master"] = masterbut inheriting the operator'srandom_mastersetting (and flagged withs_opts["multimaster"] = True). Each child then takes the single-master branch ofeval_masterand emits the warning. With N masters, the warning appears N times at startup.Setup
Steps to Reproduce the behavior
Minion config:
Restart the minion and check the log:
Expected behavior
No warning for a valid multi-master configuration. The warning should fire only for a genuinely single-master minion (one where
random_mastertruly has no effect), not for the per-master child minions theMinionManagerspawns in multi-master mode.Versions Report
Observed on 3006.26. The warning code is unguarded on the current
3006.xbranch and onmaster(theelse"single master sign in" branch ofMinionBase.eval_master).