mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Look in location salt is running from, this accounts for running from an unpacked onedir file that has not been installed.
This commit is contained in:
parent
7674112d14
commit
9de739f9dd
2 changed files with 33 additions and 0 deletions
|
@ -37,6 +37,12 @@ def _find_libcrypto():
|
|||
# system.
|
||||
# look in salts pkg install location.
|
||||
lib = glob.glob("/opt/salt/lib/libcrypto.dylib")
|
||||
|
||||
# look in location salt is running from
|
||||
# this accounts for running from an unpacked
|
||||
# onedir file
|
||||
lib = lib or glob.glob(os.path.join("lib/libcrypto.dylib"))
|
||||
|
||||
# Find library symlinks in Homebrew locations.
|
||||
brew_prefix = os.getenv("HOMEBREW_PREFIX", "/usr/local")
|
||||
lib = lib or glob.glob(
|
||||
|
|
|
@ -276,3 +276,30 @@ class RSAX931Test(TestCase):
|
|||
or hasattr(lib, "OPENSSL_init_crypto")
|
||||
or hasattr(lib, "OPENSSL_no_config")
|
||||
)
|
||||
|
||||
@patch.object(salt.utils.platform, "is_darwin", lambda: True)
|
||||
@patch.object(platform, "mac_ver", lambda: ("10.15.2", (), ""))
|
||||
@patch.object(sys, "platform", "macosx")
|
||||
def test_find_libcrypto_darwin_onedir(self):
|
||||
"""
|
||||
Test _find_libcrypto on a macOS
|
||||
libcryptos and defaulting to the versioned system libraries.
|
||||
"""
|
||||
available = [
|
||||
"/usr/lib/libcrypto.0.9.7.dylib",
|
||||
"/usr/lib/libcrypto.0.9.8.dylib",
|
||||
"/usr/lib/libcrypto.35.dylib",
|
||||
"/usr/lib/libcrypto.41.dylib",
|
||||
"/usr/lib/libcrypto.42.dylib",
|
||||
"/usr/lib/libcrypto.44.dylib",
|
||||
"/test/homebrew/prefix/opt/openssl/lib/libcrypto.dylib",
|
||||
"/opt/local/lib/libcrypto.dylib",
|
||||
"lib/libcrypto.dylib",
|
||||
]
|
||||
|
||||
def test_glob(pattern):
|
||||
return [lib for lib in available if fnmatch.fnmatch(lib, pattern)]
|
||||
|
||||
with patch.object(glob, "glob", test_glob):
|
||||
lib_path = _find_libcrypto()
|
||||
self.assertEqual("lib/libcrypto.dylib", lib_path)
|
||||
|
|
Loading…
Add table
Reference in a new issue