Skip to content

Commit

Permalink
Merge pull request saltstack#63924 from MKLeb/hotfix/3006.x/sys-meta-…
Browse files Browse the repository at this point in the history
…path-not-available

Fix sys.meta_path is None
  • Loading branch information
garethgreenaway authored Apr 7, 2023
2 parents 1619cbc + fd10f10 commit 9889d12
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
55 changes: 55 additions & 0 deletions pkg/tests/integration/test_clean_zmq_teardown.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import logging
import pathlib
import shutil
import textwrap

import pytest

pytestmark = [
pytest.mark.skip_on_windows,
]

log = logging.getLogger(__name__)


def test_check_no_import_error(salt_call_cli, salt_master):
"""
Test that we don't have any errors on teardown of python when using a py-rendered sls file
This is a package test because the issue was not reproducible in our normal test suite
"""
init_sls = textwrap.dedent(
"""#!py
def run():
return {
"file_foobar": {
"file.managed": [
{
"name": "/foobar"
},
{
"template": "jinja"
},
{
"context": {
"foobar": "baz",
}
},
{
"source": "salt://breaks/foobar.jinja",
}
]
}
}
"""
)
base_tree = pathlib.Path(salt_master.config["file_roots"]["base"][0])
breaks_tree = base_tree / "breaks"
breaks_tree.mkdir(exist_ok=True)
(breaks_tree / "init.sls").write_text(init_sls)
(breaks_tree / "foobar.jinja").write_text("{{ foobar }}")
output = salt_call_cli.run("state.apply", "breaks", "--output-diff", "test=true")
log.debug(output.stderr)
shutil.rmtree(str(breaks_tree), ignore_errors=True)
assert not output.stderr
1 change: 1 addition & 0 deletions salt/transport/zeromq.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ def close(self):
self.socket = None
self.stream = None
if self.context.closed is False:
# This hangs if closing the stream causes an import error
self.context.term()

def _init_socket(self):
Expand Down

0 comments on commit 9889d12

Please sign in to comment.