mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
move lock
This commit is contained in:
parent
24bd2879ff
commit
dd511289d1
4 changed files with 106 additions and 2 deletions
|
@ -565,7 +565,7 @@ class GitProvider:
|
|||
return ret
|
||||
|
||||
def _get_lock_file(self, lock_type="update"):
|
||||
return salt.utils.path.join(self.gitdir, lock_type + ".lk")
|
||||
return salt.utils.path.join(self._salt_working_dir, lock_type + ".lk")
|
||||
|
||||
@classmethod
|
||||
def add_conf_overlay(cls, name):
|
||||
|
@ -857,7 +857,6 @@ class GitProvider:
|
|||
self.id,
|
||||
desired_ssl_verify,
|
||||
)
|
||||
self._ssl_verfiy = self.opts.get(f"{self.role}_ssl_verify", None)
|
||||
conf_changed = True
|
||||
|
||||
# Write changes, if necessary
|
||||
|
|
|
@ -238,3 +238,38 @@ def test_gitpython_remote_map(gitpython_gitfs_opts):
|
|||
@skipif_no_pygit2
|
||||
def test_pygit2_remote_map(pygit2_gitfs_opts):
|
||||
_test_remote_map(pygit2_gitfs_opts)
|
||||
|
||||
|
||||
def _test_lock(opts):
|
||||
g = _get_gitfs(
|
||||
opts,
|
||||
"https://github.com/saltstack/salt-test-pillar-gitfs.git",
|
||||
)
|
||||
g.fetch_remotes()
|
||||
assert len(g.remotes) == 1
|
||||
repo = g.remotes[0]
|
||||
assert repo.get_salt_working_dir() in repo._get_lock_file()
|
||||
assert repo.lock() == (
|
||||
[
|
||||
"Set update lock for gitfs remote 'https://github.com/saltstack/salt-test-pillar-gitfs.git'"
|
||||
],
|
||||
[],
|
||||
)
|
||||
assert os.path.isfile(repo._get_lock_file())
|
||||
assert repo.clear_lock() == (
|
||||
[
|
||||
"Removed update lock for gitfs remote 'https://github.com/saltstack/salt-test-pillar-gitfs.git'"
|
||||
],
|
||||
[],
|
||||
)
|
||||
assert not os.path.isfile(repo._get_lock_file())
|
||||
|
||||
|
||||
@skipif_no_gitpython
|
||||
def test_gitpython_lock(gitpython_gitfs_opts):
|
||||
_test_lock(gitpython_gitfs_opts)
|
||||
|
||||
|
||||
@skipif_no_pygit2
|
||||
def test_pygit2_lock(pygit2_gitfs_opts):
|
||||
_test_lock(pygit2_gitfs_opts)
|
||||
|
|
|
@ -328,3 +328,38 @@ def test_gitpython_remote_map(gitpython_pillar_opts):
|
|||
@skipif_no_pygit2
|
||||
def test_pygit2_remote_map(pygit2_pillar_opts):
|
||||
_test_remote_map(pygit2_pillar_opts)
|
||||
|
||||
|
||||
def _test_lock(opts):
|
||||
p = _get_pillar(
|
||||
opts,
|
||||
"https://github.com/saltstack/salt-test-pillar-gitfs.git",
|
||||
)
|
||||
p.fetch_remotes()
|
||||
assert len(p.remotes) == 1
|
||||
repo = p.remotes[0]
|
||||
assert repo.get_salt_working_dir() in repo._get_lock_file()
|
||||
assert repo.lock() == (
|
||||
[
|
||||
"Set update lock for git_pillar remote 'https://github.com/saltstack/salt-test-pillar-gitfs.git'"
|
||||
],
|
||||
[],
|
||||
)
|
||||
assert os.path.isfile(repo._get_lock_file())
|
||||
assert repo.clear_lock() == (
|
||||
[
|
||||
"Removed update lock for git_pillar remote 'https://github.com/saltstack/salt-test-pillar-gitfs.git'"
|
||||
],
|
||||
[],
|
||||
)
|
||||
assert not os.path.isfile(repo._get_lock_file())
|
||||
|
||||
|
||||
@skipif_no_gitpython
|
||||
def test_gitpython_lock(gitpython_pillar_opts):
|
||||
_test_lock(gitpython_pillar_opts)
|
||||
|
||||
|
||||
@skipif_no_pygit2
|
||||
def test_pygit2_lock(pygit2_pillar_opts):
|
||||
_test_lock(pygit2_pillar_opts)
|
||||
|
|
|
@ -127,3 +127,38 @@ def test_gitpython_remote_map(gitpython_winrepo_opts):
|
|||
@skipif_no_pygit2
|
||||
def test_pygit2_remote_map(pygit2_winrepo_opts):
|
||||
_test_remote_map(pygit2_winrepo_opts)
|
||||
|
||||
|
||||
def _test_lock(opts):
|
||||
w = _get_winrepo(
|
||||
opts,
|
||||
"https://github.com/saltstack/salt-test-pillar-gitfs.git",
|
||||
)
|
||||
w.fetch_remotes()
|
||||
assert len(w.remotes) == 1
|
||||
repo = w.remotes[0]
|
||||
assert repo.get_salt_working_dir() in repo._get_lock_file()
|
||||
assert repo.lock() == (
|
||||
[
|
||||
"Set update lock for winrepo remote 'https://github.com/saltstack/salt-test-pillar-gitfs.git'"
|
||||
],
|
||||
[],
|
||||
)
|
||||
assert os.path.isfile(repo._get_lock_file())
|
||||
assert repo.clear_lock() == (
|
||||
[
|
||||
"Removed update lock for winrepo remote 'https://github.com/saltstack/salt-test-pillar-gitfs.git'"
|
||||
],
|
||||
[],
|
||||
)
|
||||
assert not os.path.isfile(repo._get_lock_file())
|
||||
|
||||
|
||||
@skipif_no_gitpython
|
||||
def test_gitpython_lock(gitpython_winrepo_opts):
|
||||
_test_lock(gitpython_winrepo_opts)
|
||||
|
||||
|
||||
@skipif_no_pygit2
|
||||
def test_pygit2_lock(pygit2_winrepo_opts):
|
||||
_test_lock(pygit2_winrepo_opts)
|
||||
|
|
Loading…
Add table
Reference in a new issue