Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/69199.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed Salt-SSH syncing internal modules as extmods
4 changes: 4 additions & 0 deletions salt/client/ssh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
"__"
Expand Down
17 changes: 17 additions & 0 deletions tests/pytests/unit/client/ssh/test_extmods.py
Original file line number Diff line number Diff line change
@@ -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])
Loading