summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2017-07-26 10:24:47 +0100
committerJürg Billeter <j@bitron.ch>2017-07-26 10:24:47 +0100
commitd30550048d53a06985cb3dffda7422813980de1f (patch)
tree4d7a474609efe853092bff1f9ee2d170ae6d5c64
parent8f401127c450ea1c2a1e2878d2ac28a7166d355c (diff)
downloadbuildstream-d30550048d53a06985cb3dffda7422813980de1f.tar.gz
_artifactcache/pushreceive.py: Drop branch check in receiver
The pusher already checks this and the check in the receiver does not provide any additional guarantees as it is prone to race conditions. This prevents a push error in case two clients push an artifact with the same key around the same time. Fixes #52
-rw-r--r--buildstream/_artifactcache/pushreceive.py19
1 files changed, 1 insertions, 18 deletions
diff --git a/buildstream/_artifactcache/pushreceive.py b/buildstream/_artifactcache/pushreceive.py
index f47076c76..774fac30a 100644
--- a/buildstream/_artifactcache/pushreceive.py
+++ b/buildstream/_artifactcache/pushreceive.py
@@ -548,24 +548,7 @@ class OSTreeReceiver(object):
if cmdtype == PushCommandType.done:
return 0
update_refs = args
- for branch, revs in update_refs.items():
- # Check that each branch can be updated appropriately
- _, current = self.repo.resolve_rev(branch, True)
- if current is None:
- # From commit should be all 0s
- if revs[0] != '0' * 64:
- self.writer.send_status(False,
- 'Invalid from commit %s '
- 'for new branch %s' % (revs[0], branch))
- self.reader.receive_done()
- return 1
- elif revs[0] != current:
- self.writer.send_status(False,
- 'Branch %s is at %s, not %s' % (branch, current, revs[0]))
- self.reader.receive_done()
- return 1
-
- # All updates valid
+
self.writer.send_status(True)
# Wait for putobjects or done