From 31254b09e53d9991ba704a5d216c94a17ba079a3 Mon Sep 17 00:00:00 2001 From: jeanluc Date: Thu, 21 May 2026 12:52:21 +0200 Subject: [PATCH 1/2] Add test for issue #69199 --- tests/pytests/unit/client/ssh/test_extmods.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/pytests/unit/client/ssh/test_extmods.py diff --git a/tests/pytests/unit/client/ssh/test_extmods.py b/tests/pytests/unit/client/ssh/test_extmods.py new file mode 100644 index 000000000000..354581196506 --- /dev/null +++ b/tests/pytests/unit/client/ssh/test_extmods.py @@ -0,0 +1,17 @@ +import re + +import salt.client.ssh +import salt.fileclient +from tests.support.mock import MagicMock, patch + + +def test_internal_modules_are_not_synced_as_extmods(master_opts): + fsclient = salt.fileclient.FSClient(master_opts) + tar = MagicMock() + with patch("tarfile.open", return_value=tar): + salt.client.ssh.mod_data(fsclient) + ptrn = re.compile( + r".*/salt/(modules|states|grains|renderers|returners|utils)/\w+\.py$" + ) + for call in tar.add.call_args_list: + assert not ptrn.match(call[0][0]) From 4bfffdfe2e1e06a8a0b8b3874ce092a542977390 Mon Sep 17 00:00:00 2001 From: jeanluc Date: Thu, 21 May 2026 12:52:56 +0200 Subject: [PATCH 2/2] Fix internal modules being synced as external ones --- changelog/69199.fixed.md | 1 + salt/client/ssh/__init__.py | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 changelog/69199.fixed.md diff --git a/changelog/69199.fixed.md b/changelog/69199.fixed.md new file mode 100644 index 000000000000..90e31cbdba3d --- /dev/null +++ b/changelog/69199.fixed.md @@ -0,0 +1 @@ +Fixed Salt-SSH syncing internal modules as extmods diff --git a/salt/client/ssh/__init__.py b/salt/client/ssh/__init__.py index 960362ec05a0..9488a88756c9 100644 --- a/salt/client/ssh/__init__.py +++ b/salt/client/ssh/__init__.py @@ -1742,6 +1742,10 @@ def mod_data(fsclient): if not os.path.isdir(mod_dir): continue + # Skip internal salt modules - they should be in the thin/relenv tarball + if mod_dir.startswith(str(salt.loader.SALT_BASE_PATH)): + continue + for fn_ in os.listdir(mod_dir): if fn_.endswith((".py", ".so", ".pyx")) and not fn_.startswith( "__"