mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Make the underscore directory standard
This commit is contained in:
parent
e5d1e4db9d
commit
0c05af434a
6 changed files with 13 additions and 7 deletions
|
@ -174,7 +174,11 @@ def update_git_repos(opts=None, clean=False, masterless=False):
|
|||
rev, remote_url = remote_info.strip().split()
|
||||
except ValueError:
|
||||
remote_url = remote_info
|
||||
gittarget = os.path.join(base_dir, targetname).replace(".git", "")
|
||||
targetname = targetname.replace(".git", "")
|
||||
# GitFS using pygit2 and gitpython place the repo in a
|
||||
# subdirectory named `_`. We need to stay consistent when using
|
||||
# the legacy method as well
|
||||
gittarget = os.path.join(base_dir, targetname, "_")
|
||||
if masterless:
|
||||
result = __salt__["state.single"](
|
||||
"git.latest",
|
||||
|
|
|
@ -472,7 +472,7 @@ class GitProvider:
|
|||
"/", "_"
|
||||
) # replace "/" with "_" to not cause trouble with file system
|
||||
self._cache_hash = salt.utils.path.join(cache_root, self._cache_basehash)
|
||||
self._cache_basename = ""
|
||||
self._cache_basename = "_"
|
||||
if self.id.startswith("__env__"):
|
||||
try:
|
||||
self._cache_basename = self.get_checkout_target()
|
||||
|
|
|
@ -41,6 +41,7 @@ def test_update_git_repos(winrepo_remotes):
|
|||
assert res[remote]
|
||||
|
||||
# Make sure there are package definitions in the root
|
||||
assert res[remote].endswith("_")
|
||||
pkg_def = os.path.join(res[remote], "7zip.sls")
|
||||
assert os.path.exists(pkg_def)
|
||||
|
||||
|
@ -63,9 +64,9 @@ def test_legacy_update_git_repos(winrepo_remotes, minion_opts):
|
|||
# update only returns True or False, not a path
|
||||
if "-ng" in remote:
|
||||
path = minion_opts["winrepo_dir_ng"]
|
||||
pkg_def = os.path.join(path, "salt-winrepo-ng", "7zip.sls")
|
||||
pkg_def = os.path.join(path, "salt-winrepo-ng", "_", "7zip.sls")
|
||||
else:
|
||||
path = minion_opts["winrepo_dir"]
|
||||
pkg_def = os.path.join(path, "salt-winrepo", "7zip.sls")
|
||||
pkg_def = os.path.join(path, "salt-winrepo", "_", "7zip.sls")
|
||||
|
||||
assert os.path.exists(pkg_def)
|
||||
|
|
|
@ -7,6 +7,7 @@ from salt.utils.gitfs import GitPillar, GitPython, Pygit2
|
|||
from salt.utils.immutabletypes import ImmutableDict, ImmutableList
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.windows_whitelisted,
|
||||
pytest.mark.slow_test,
|
||||
]
|
||||
|
||||
|
|
|
@ -248,4 +248,4 @@ def test_checkout_pygit2(_prepare_provider):
|
|||
reason="Skip Pygit2 on windows, due to pygit2 access error on windows"
|
||||
)
|
||||
def test_get_cachedir_basename_pygit2(_prepare_provider):
|
||||
assert "" == _prepare_provider.get_cache_basename()
|
||||
assert "_" == _prepare_provider.get_cache_basename()
|
||||
|
|
|
@ -117,11 +117,11 @@ class TestGitBase(TestCase, AdaptedConfigurationTestCaseMixin):
|
|||
def test_get_cachedir_basename(self):
|
||||
self.assertEqual(
|
||||
self.main_class.remotes[0].get_cache_basename(),
|
||||
"",
|
||||
"_",
|
||||
)
|
||||
self.assertEqual(
|
||||
self.main_class.remotes[1].get_cache_basename(),
|
||||
"",
|
||||
"_",
|
||||
)
|
||||
|
||||
def test_git_provider_mp_lock(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue