Skip to content

Commit

Permalink
Make Salt-SSH sync custom utils
Browse files Browse the repository at this point in the history
  • Loading branch information
lkubb authored and dwoz committed Dec 21, 2023
1 parent 9f5a1a7 commit fbb6728
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog/53666.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Made salt-ssh sync custom utils
1 change: 1 addition & 0 deletions salt/client/ssh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1802,6 +1802,7 @@ def mod_data(fsclient):
"grains",
"renderers",
"returners",
"utils",
]
ret = {}
with fsclient:
Expand Down
34 changes: 34 additions & 0 deletions tests/pytests/integration/ssh/test_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit fbb6728

Please sign in to comment.