Disable FQDNs grains on macOS by default

This commit is contained in:
jeanluc 2022-12-05 18:01:10 +01:00 committed by Megan Wilhite
parent f70bb96fb3
commit f9737ea019
4 changed files with 10 additions and 2 deletions

1
changelog/62168.changed Normal file
View file

@ -0,0 +1 @@
Disabled FQDNs grains on macOS by default

View file

@ -65,6 +65,12 @@ elif salt.utils.platform.is_proxy():
_DFLT_FQDNS_GRAINS = False
_MASTER_TRIES = 1
_MASTER_USER = salt.utils.user.get_user()
elif salt.utils.platform.is_darwin():
_DFLT_IPC_MODE = "ipc"
# fqdn resolution can be very slow on macOS, see issue #62168
_DFLT_FQDNS_GRAINS = False
_MASTER_TRIES = 1
_MASTER_USER = salt.utils.user.get_user()
else:
_DFLT_IPC_MODE = "ipc"
_DFLT_FQDNS_GRAINS = False

View file

@ -2806,6 +2806,7 @@ def fqdns():
or salt.utils.platform.is_sunos()
or salt.utils.platform.is_aix()
or salt.utils.platform.is_junos()
or salt.utils.platform.is_darwin()
else True,
):
opt = __salt__["network.fqdns"]()

View file

@ -2144,8 +2144,8 @@ def test_enable_fqdns_without_patching():
"salt.grains.core.__salt__",
{"network.fqdns": MagicMock(return_value="my.fake.domain")},
):
# fqdns is disabled by default on Windows
if salt.utils.platform.is_windows():
# fqdns is disabled by default on Windows and macOS
if salt.utils.platform.is_windows() or salt.utils.platform.is_darwin():
assert core.fqdns() == {"fqdns": []}
else:
assert core.fqdns() == "my.fake.domain"