Do not contest locks in PythonGit
The config writer should be used in a context manager form to ensure locks are shared and the data is properly written out. In python 2 it looks as if the locks were not properly handled and multiple config writers would just lock the same file (and write) blindly. In python 3, the context manager is required to not raise an exception when writing the config due to the lock already being held by another config_writer. Change-Id: I42a9804638c6065127ce31a1865b017bf969855f
This commit is contained in:
parent
0aa7e8bdbf
commit
78c301afed
|
@ -1169,9 +1169,9 @@ class ZuulTestCase(BaseTestCase):
|
|||
path = os.path.join(self.upstream_root, project)
|
||||
repo = git.Repo.init(path)
|
||||
|
||||
repo.config_writer().set_value('user', 'email', 'user@example.com')
|
||||
repo.config_writer().set_value('user', 'name', 'User Name')
|
||||
repo.config_writer().write()
|
||||
with repo.config_writer() as config_writer:
|
||||
config_writer.set_value('user', 'email', 'user@example.com')
|
||||
config_writer.set_value('user', 'name', 'User Name')
|
||||
|
||||
fn = os.path.join(path, 'README')
|
||||
f = open(fn, 'w')
|
||||
|
|
|
@ -17,7 +17,7 @@ import yaml
|
|||
|
||||
import voluptuous as vs
|
||||
|
||||
import model
|
||||
from zuul import model
|
||||
import zuul.manager
|
||||
import zuul.manager.dependent
|
||||
import zuul.manager.independent
|
||||
|
|
Loading…
Reference in New Issue