diff --git a/changelog/53666.added.md b/changelog/53666.added.md new file mode 100644 index 000000000000..0f82455c9342 --- /dev/null +++ b/changelog/53666.added.md @@ -0,0 +1 @@ +Made salt-ssh sync custom utils diff --git a/salt/client/ssh/__init__.py b/salt/client/ssh/__init__.py index d3075bf0ae98..c547cb1b136a 100644 --- a/salt/client/ssh/__init__.py +++ b/salt/client/ssh/__init__.py @@ -1802,6 +1802,7 @@ def mod_data(fsclient): "grains", "renderers", "returners", + "utils", ] ret = {} with fsclient: diff --git a/tests/pytests/integration/ssh/test_deploy.py b/tests/pytests/integration/ssh/test_deploy.py index a460e435dd07..74d8c8862a7b 100644 --- a/tests/pytests/integration/ssh/test_deploy.py +++ b/tests/pytests/integration/ssh/test_deploy.py @@ -319,3 +319,37 @@ def test_wrapper_unwrapped_command_invalid_return(salt_ssh_cli): assert ret.data["parsed"] == { "local": {"no_return_key_present": "Chaos is a ladder though"} } + + +@pytest.fixture(scope="module") +def utils_dependent_module(salt_run_cli, salt_master): + module_contents = r""" +import customutilsmodule + + +def __virtual__(): + return "utilsync" + + +def test(): + return customutilsmodule.test() +""" + utils_contents = r""" +def test(): + return "success" +""" + module_tempfile = salt_master.state_tree.base.temp_file( + "_modules/utilsync.py", contents=module_contents + ) + util_tempfile = salt_master.state_tree.base.temp_file( + "_utils/customutilsmodule.py", contents=utils_contents + ) + with module_tempfile, util_tempfile: + yield + + +@pytest.mark.usefixtures("utils_dependent_module") +def test_custom_utils_are_present_on_target(salt_ssh_cli): + ret = salt_ssh_cli.run("utilsync.test") + assert ret.returncode == 0 + assert ret.data == "success"