enable_fqdns_grains default to false on Windows

This commit is contained in:
twangboy 2020-06-05 17:40:03 -06:00 committed by Daniel Wozniak
parent a148efbc94
commit 443be978ea
4 changed files with 36 additions and 1 deletions

View file

@ -157,6 +157,16 @@
# Set the directory used to hold unix sockets.
#sock_dir: /var/run/salt/minion
# In order to calculate the fqdns grain, all the IP addresses from the minion
# are processed with underlying calls to `socket.gethostbyaddr` which can take
# 5 seconds to be released (after reaching `socket.timeout`) when there is no
# fqdn for that IP. These calls to `socket.gethostbyaddr` are processed
# asynchronously, however, it still adds 5 seconds every time grains are
# generated if an IP does not resolve. In Windows grains are regenerated each
# time a new process is spawned. Therefore, the default for Windows is `False`.
# All other OSes default to `True`
# enable_fqdn_grains: True
# The minion can take a while to start up when lspci and/or dmidecode is used
# to populate the grains for the minion. Set this to False if you do not need
# GPU hardware grains for your minion.

View file

@ -1053,6 +1053,26 @@ The directory where Unix sockets will be kept.
sock_dir: /var/run/salt/minion
.. conf_minion:: enable_fqdns_grains
``enable_fqdns_grains``
-----------------------
Default: ``True``
In order to calculate the fqdns grain, all the IP addresses from the minion are
processed with underlying calls to ``socket.gethostbyaddr`` which can take 5 seconds
to be released (after reaching ``socket.timeout``) when there is no fqdn for that IP.
These calls to ``socket.gethostbyaddr`` are processed asynchronously, however, it still
adds 5 seconds every time grains are generated if an IP does not resolve. In Windows
grains are regenerated each time a new process is spawned. Therefore, the default for
Windows is ``False``. All other OSes default to ``True``. This options was
added `here <https://github.com/saltstack/salt/pull/55581>`_.
.. code-block:: yaml
enable_fqdns_grains: False
.. conf_minion:: enable_gpu_grains
``enable_gpu_grains``

View file

@ -66,12 +66,14 @@ if salt.utils.platform.is_windows():
# support in ZeroMQ, we want the default to be something that has a
# chance of working.
_DFLT_IPC_MODE = "tcp"
_DFLT_FQDNS_GRAINS = False
_MASTER_TRIES = -1
# This needs to be SYSTEM in order for salt-master to run as a Service
# Otherwise, it will not respond to CLI calls
_MASTER_USER = "SYSTEM"
else:
_DFLT_IPC_MODE = "ipc"
_DFLT_FQDNS_GRAINS = True
_MASTER_TRIES = 1
_MASTER_USER = salt.utils.user.get_user()
@ -352,6 +354,8 @@ VALID_OPTS = immutabletypes.freeze(
"test": bool,
# Tell the loader to attempt to import *.pyx cython files if cython is available
"cython_enable": bool,
# Whether or not to load grains for FQDNs
"enable_fqdns_grains": bool,
# Whether or not to load grains for the GPU
"enable_gpu_grains": bool,
# Tell the loader to attempt to import *.zip archives
@ -1133,6 +1137,7 @@ DEFAULT_MINION_OPTS = immutabletypes.freeze(
"test": False,
"ext_job_cache": "",
"cython_enable": False,
"enable_fqdns_grains": _DFLT_FQDNS_GRAINS,
"enable_gpu_grains": True,
"enable_zip_modules": False,
"state_verbose": True,

View file

@ -2352,7 +2352,7 @@ def fqdns():
# Provides:
# fqdns
opt = {"fqdns": []}
if __opts__.get("enable_fqdns_grains", True):
if __opts__.get("enable_fqdns_grains", False if salt.utils.platform.is_windows() else True):
opt = __salt__["network.fqdns"]()
return opt